[GH-ISSUE #117] Error with L SEP chars in source #1945

Closed
opened 2026-03-07 20:03:01 +03:00 by kerem · 3 comments
Owner

Originally created by @scop on GitHub (Mar 28, 2018).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/117

The atached source file (which contains L SEP characters, U+2028 at end of hello and world lines) provokes an error when checked with markdownlint-cli 0.8.1 and markdownlint 0.8.1:

/usr/local/lib/node_modules/markdownlint/lib/markdownlint.js:161
      while (token.map[1] && !(lines[token.map[1] - 1].trim())) {
                                                       ^

TypeError: Cannot read property 'trim' of undefined
    at forToken (/usr/local/lib/node_modules/markdownlint/lib/markdownlint.js:161:56)
    at Array.forEach (<anonymous>)
    at annotateTokens (/usr/local/lib/node_modules/markdownlint/lib/markdownlint.js:144:10)
    at lintContent (/usr/local/lib/node_modules/markdownlint/lib/markdownlint.js:298:3)
    at lintContentWrapper (/usr/local/lib/node_modules/markdownlint/lib/markdownlint.js:413:5)
    at lintFile (/usr/local/lib/node_modules/markdownlint/lib/markdownlint.js:418:5)
    at lintNextItem (/usr/local/lib/node_modules/markdownlint/lib/markdownlint.js:474:9)
    at lintInput (/usr/local/lib/node_modules/markdownlint/lib/markdownlint.js:488:3)
    at Function.markdownlintSync [as sync] (/usr/local/lib/node_modules/markdownlint/lib/markdownlint.js:510:3)
    at lintAndPrint (/usr/local/lib/node_modules/markdownlint-cli/markdownlint.js:142:33)

test.md.gz

Originally created by @scop on GitHub (Mar 28, 2018). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/117 The atached source file (which contains L SEP characters, U+2028 at end of hello and world lines) provokes an error when checked with markdownlint-cli 0.8.1 and markdownlint 0.8.1: ``` /usr/local/lib/node_modules/markdownlint/lib/markdownlint.js:161 while (token.map[1] && !(lines[token.map[1] - 1].trim())) { ^ TypeError: Cannot read property 'trim' of undefined at forToken (/usr/local/lib/node_modules/markdownlint/lib/markdownlint.js:161:56) at Array.forEach (<anonymous>) at annotateTokens (/usr/local/lib/node_modules/markdownlint/lib/markdownlint.js:144:10) at lintContent (/usr/local/lib/node_modules/markdownlint/lib/markdownlint.js:298:3) at lintContentWrapper (/usr/local/lib/node_modules/markdownlint/lib/markdownlint.js:413:5) at lintFile (/usr/local/lib/node_modules/markdownlint/lib/markdownlint.js:418:5) at lintNextItem (/usr/local/lib/node_modules/markdownlint/lib/markdownlint.js:474:9) at lintInput (/usr/local/lib/node_modules/markdownlint/lib/markdownlint.js:488:3) at Function.markdownlintSync [as sync] (/usr/local/lib/node_modules/markdownlint/lib/markdownlint.js:510:3) at lintAndPrint (/usr/local/lib/node_modules/markdownlint-cli/markdownlint.js:142:33) ``` [test.md.gz](https://github.com/DavidAnson/markdownlint/files/1855531/test.md.gz)
kerem 2026-03-07 20:03:01 +03:00
Author
Owner

@DavidAnson commented on GitHub (Mar 28, 2018):

Sorry, I’ll have a look soon! Offhand, it seems there may be confusion about line breaks, likely due to the uncommon character used here.

<!-- gh-comment-id:376940177 --> @DavidAnson commented on GitHub (Mar 28, 2018): Sorry, I’ll have a look soon! Offhand, it seems there may be confusion about line breaks, likely due to the uncommon character used here.
Author
Owner

@DavidAnson commented on GitHub (Mar 28, 2018):

Researching briefly, L SEP is a line separator character, which seems relevant for a line breaking bug. I expect there is a mismatch between the linter and the parser about what, exactly, ends a line. Should not be hard to fix.

<!-- gh-comment-id:376942930 --> @DavidAnson commented on GitHub (Mar 28, 2018): Researching briefly, L SEP is a line separator character, which seems relevant for a line breaking bug. I expect there is a mismatch between the linter and the parser about what, exactly, ends a line. Should not be hard to fix.
Author
Owner

@scop commented on GitHub (Mar 30, 2018):

Just to be clear, the use of L SEP in the case I saw them in was almost certainly not intentional, and unnecessary anyway so I've removed them. But it would be good to handle this more gracefully in markdownlint.

<!-- gh-comment-id:377557788 --> @scop commented on GitHub (Mar 30, 2018): Just to be clear, the use of L SEP in the case I saw them in was almost certainly not intentional, and unnecessary anyway so I've removed them. But it would be good to handle this more gracefully in markdownlint.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#1945
No description provided.