Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Tokenizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,9 @@ export class _Tokenizer {
if (lastItem) {
lastItem.raw = lastItem.raw.trimEnd();
lastItem.text = lastItem.text.trimEnd();
} else {
// not a list since there were no items
return;
}
list.raw = list.raw.trimEnd();

Expand Down
14 changes: 14 additions & 0 deletions test/unit/marked.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,20 @@ describe('marked unit', () => {
assert.strictEqual(html, '<p>Not Underlined A</p>\n<u>Underlined B</u>\n<p>Not Underlined C\n:Not Underlined D</p>\n');
});

it('should not return list if no items', () => {
const noHr = {
tokenizer: {
hr() {
return undefined;
},
},
};
marked.use(noHr);
const markdown = '- - -';
const html = marked.parse(markdown);
assert.strictEqual(html, '<p>- - -</p>\n');
});

it('should use custom inline tokenizer + renderer extensions', () => {
const underline = {
name: 'underline',
Expand Down
Loading