Skip to content

Lexer: Space after list appears in last list_item #1947

@ApayRus

Description

@ApayRus

marked 2.0.0

Sorry if it is not a bug, but a feature...

In a semantic tree (marked.lexer) an empty space between List and Paragraph appears in a last list_item. It looks unlogical.

While traverse the tree, you should write additional code for exclude this empty space from list_item. And then write code to add space between List and Paragraph.

Expected: Space node should be at the first level of the semantic tree, between the List and the next Paragraph

for reproduce, please visit:
https://codesandbox.io/s/markedjs-klt1h?file=/src/marked8lexer.js

import marked from "marked";

const markdownText = `This is paragraph 

this is a list with 3 items: 

- item one 
- item two 
- item tree 

Here is another paragrah.`;

const lexerArray = marked.lexer(markdownText);

console.log(lexerArray);

Screenshot from 2021-02-15 19-40-18

Metadata

Metadata

Assignees

No one assigned

    Labels

    L2 - annoyingSimilar to L1 - broken but there is a known workaround available for the issuecategory: listsreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions