mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-04-14 19:56:23 +00:00
fix #12118: pass mandatory second parameter to markdown-it parse method
This commit is contained in:
parent
c4343379a1
commit
188023b197
2 changed files with 17 additions and 1 deletions
|
|
@ -105,4 +105,18 @@ describe('highlightMentions', () => {
|
|||
expect(result[0]).to.equal('[@user](/profile/111) `@user`');
|
||||
});
|
||||
});
|
||||
|
||||
it('github issue 12118, method crashes when square brackets are used', async () => {
|
||||
const text = '[test]';
|
||||
|
||||
let err;
|
||||
|
||||
try {
|
||||
await highlightMentions(text);
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
|
||||
expect(err).to.be.undefined;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -76,7 +76,9 @@ function createCodeBlockRegex ({ content, type, markup }) {
|
|||
*/
|
||||
function findTextAndCodeBlocks (text) {
|
||||
// For token description see https://markdown-it.github.io/markdown-it/#Token
|
||||
const tokens = habiticaMarkdown.parse(text);
|
||||
// The second parameter is mandatory even if not used, see
|
||||
// https://markdown-it.github.io/markdown-it/#MarkdownIt.parse
|
||||
const tokens = habiticaMarkdown.parse(text, {});
|
||||
const codeBlocks = findCodeBlocks(tokens);
|
||||
|
||||
const blocks = [];
|
||||
|
|
|
|||
Loading…
Reference in a new issue