Skip to content

fix: fix empty list item#3890

Merged
UziTech merged 1 commit intomarkedjs:masterfrom
UziTech:empty-list-item
Feb 11, 2026
Merged

fix: fix empty list item#3890
UziTech merged 1 commit intomarkedjs:masterfrom
UziTech:empty-list-item

Conversation

@UziTech
Copy link
Member

@UziTech UziTech commented Feb 9, 2026

Marked version: 17.0.1

Description

Contributor

  • Test(s) exist to ensure functionality and minimize regression (if no tests added, list tests covering this PR); or,
  • no tests required for this PR.
  • If submitting new feature, it has been documented in the appropriate places.

Committer

In most cases, this should be a different person than the contributor.

@vercel
Copy link

vercel bot commented Feb 9, 2026

@UziTech is attempting to deploy a commit to the MarkedJS Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Feb 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marked-website Ready Ready Preview, Comment Feb 9, 2026 4:51am

Request Review

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @UziTech, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue where empty list items were not being correctly parsed or rendered. It refactors the regular expressions responsible for identifying bullet points and list structures to properly handle leading spaces. This ensures that empty list items are correctly processed, as demonstrated by the newly added test cases, resolving the reported bug.

Highlights

  • Bullet Regex Update: The bullet regular expression in src/rules.ts has been updated to correctly account for up to three leading spaces, ensuring better parsing of list items.
  • List Regex Simplification: The list regular expression in src/rules.ts was simplified by removing redundant leading space handling, now relying on the updated bullet regex for consistency.
  • New Test Cases: New test files (list_item_empty.md and list_item_empty.html) have been added to specifically cover scenarios involving empty list items, addressing the reported issue Render bullet-pointed incorrectly  #2832.
Changelog
  • src/rules.ts
    • Updated the bullet regex to correctly match list items with up to three leading spaces.
    • Refactored the list regex to remove redundant space matching, relying on the enhanced bullet regex.
  • test/specs/new/list_item_empty.html
    • Added a new test file containing the expected HTML output for Markdown with empty list items.
  • test/specs/new/list_item_empty.md
    • Added a new test file containing Markdown input with empty list items to validate parsing.
Activity
  • The author, UziTech, has opened this pull request to fix an issue related to empty list items, referencing issue Render bullet-pointed incorrectly  #2832.
  • New test cases have been introduced to validate the fix for empty list items.
  • The contributor checklist indicates that tests exist to ensure functionality and minimize regression.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses a bug where an empty list item could be misinterpreted as a setext heading. The fix is implemented by modifying the regular expressions in src/rules.ts. Specifically, the optional indentation ( {0,3}) is moved from the list rule's definition into the bullet rule itself. This refactoring makes the bullet rule more self-contained and accurate. As a consequence, rules like lheading that use bullet in negative lookaheads are now better able to distinguish list items from setext underlines, which resolves the parsing error. The addition of new test files for empty list items is a great way to verify the fix and prevent regressions. The changes are logical, well-targeted, and improve the parser's correctness.

Copy link
Contributor

@calculuschild calculuschild left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Good fix.

@UziTech UziTech merged commit 3fc6a44 into markedjs:master Feb 11, 2026
8 checks passed
github-actions bot pushed a commit that referenced this pull request Feb 11, 2026
## [17.0.2](v17.0.1...v17.0.2) (2026-02-11)

### Bug Fixes

* fix blockquote after list ([#3888](#3888)) ([2a475a1](2a475a1))
* fix empty list item ([#3890](#3890)) ([3fc6a44](3fc6a44))
* fix list item wrong indent ([#3889](#3889)) ([e031175](e031175))
* fix list with tabs ([#3891](#3891)) ([9fc4f8e](9fc4f8e))
* fix strikethrough flanking rules ([#3882](#3882)) ([1a5b124](1a5b124))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Render bullet-pointed incorrectly

3 participants