Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse gets stuck in a 100% CPU loop on --- #16

Open
crucialfelix opened this issue Apr 23, 2022 · 1 comment
Open

parse gets stuck in a 100% CPU loop on --- #16

crucialfelix opened this issue Apr 23, 2022 · 1 comment

Comments

@crucialfelix
Copy link

This causes deno to use 100% cpu and grind forever:

import { Marked } from "https://deno.land/x/[email protected]/mod.ts";

const markdown = `



---

- X change client select to last interaction

- X links to region / sr


`;

const markup = Marked.parse(markdown);

That --- is either the start of a frontmatter block or it's just an <hr/> or it's a blank h1 header.

In this case I would expect it to treat it as an <hr/>

I will see if I can find time to do a PR to fix it.

Thank you!

@crucialfelix
Copy link
Author

Here's another related one:

---

Common problems that need to be solved:
Vary by industry, but the theme tends to be
statistics,
clustering,
ranking, and
classification/predictions.

Churn prediction is very common.
Collaborative filtering or ranking problems are very common (e.g. if your app serves recommendations or makes introductions).

---

error: Uncaught (in promise) YAMLError: can not read a block mapping entry; a multiline key may not be an implicit key at line 15, column 1:

^

Please report this to https://github.com/ts-stack/markdown
return new YAMLError(
^
at generateError (https://deno.land/[email protected]/encoding/_yaml/loader/loader.ts:161:10)
at throwError (https://deno.land/[email protected]/encoding/_yaml/loader/loader.ts:174:9)
at readBlockMapping (https://deno.land/[email protected]/encoding/_yaml/loader/loader.ts:1181:16)
at composeNode (https://deno.land/[email protected]/encoding/_yaml/loader/loader.ts:1502:13)
at readDocument (https://deno.land/[email protected]/encoding/_yaml/loader/loader.ts:1688:3)
at loadDocuments (https://deno.land/[email protected]/encoding/_yaml/loader/loader.ts:1750:5)
at load (https://deno.land/[email protected]/encoding/_yaml/loader/loader.ts:1780:21)
at BlockLexer.getTokens (https://deno.land/x/[email protected]/src/block-lexer.ts:303:38)
at Function.lex (https://deno.land/x/[email protected]/src/block-lexer.ts:64:18)
at Function.callBlockLexer (https://deno.land/x/[email protected]/src/marked.ts:126:23)

Actually I think throwing an invalid markdown error would be reasonable. It's not frontmatter, but it's also not well formed markdown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant