Skip to content

Markdown::parse() doesn't render lists #2

@wilaak

Description

@wilaak

Tempest version

3.0

PHP version

8.5

Operating system

Linux

Description

ListRule and OrderedListRule exist in src/LexerRules/ but aren't in Lexer::__construct's default rule array, so the default Markdown/Parser renders list syntax as literal paragraph text.

Repro:

$md = new Tempest\Markdown\Markdown(highlighter: null);

$md->parse("- item")->html;
// got:      "<p>- item</p>"
// expected: "<ul><li>item</li></ul>"

$md->parse("1. item")->html;
// got:      "<p>1. item</p>"
// expected: "<ol><li>item</li></ol>"

Side note: ListRule::shouldLex and OrderedListRule::shouldLex trigger on bare - / digit rather than - / digit. + separator, so -2 would render as a list item. Worth fixing as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions