Skip to content
New issue

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

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

Already on GitHub? # to your account

[1.4.46] Parser crash on Earmark.as_ast("\\[{:}") #494

Closed
dominicletz opened this issue Jun 25, 2024 · 5 comments
Closed

[1.4.46] Parser crash on Earmark.as_ast("\\[{:}") #494

dominicletz opened this issue Jun 25, 2024 · 5 comments
Assignees

Comments

@dominicletz
Copy link

Using Earmark for displaying .md files I found that there are certain md files that cause the parser to crash. Reducing the files to the minimum I found the minimal string to reproduce the crash is this:

iex(1)> Earmark.as_ast("\\[{:}")
** (FunctionClauseError) no function clause matching in Earmark.Parser.Helpers.AstHelpers.augment_tag_with_ial/2    
    
    The following arguments were given to Earmark.Parser.Helpers.AstHelpers.augment_tag_with_ial/2:
    
        # 1
        ["["]
    
        # 2
        %{}
    
    Attempted function clauses (showing 2 out of 2):
    
        def augment_tag_with_ial([{t, a, c, m} | tags], atts)
        def augment_tag_with_ial([], _atts)
    
    (earmark 1.4.46) lib/earmark_parser/helpers/ast_helpers.ex:29: Earmark.Parser.Helpers.AstHelpers.augment_tag_with_ial/2
    (earmark 1.4.46) lib/earmark_parser/ast/inline.ex:258: Earmark.Parser.Ast.Inline.converter_for_inline_ial/1
    (elixir 1.14.5) lib/enum.ex:4239: Enum.find_value_list/3
    (earmark 1.4.46) lib/earmark_parser/ast/inline.ex:36: Earmark.Parser.Ast.Inline._convert/4
    (earmark 1.4.46) lib/earmark_parser/ast_renderer.ex:32: Earmark.Parser.AstRenderer.render_block/3
    (earmark 1.4.46) lib/earmark_parser/ast_renderer.ex:23: Earmark.Parser.AstRenderer._render/3
    (earmark 1.4.46) lib/earmark_parser.ex:592: Earmark.Parser.as_ast/2
    (earmark 1.4.46) lib/earmark.ex:234: Earmark.as_ast/2
@amit-chaudhari1
Copy link
Collaborator

Hello!
I've been swamped with my actual job, sorry for the delay, I'll take a look into this,

Could you share the file or parts of it that caused this?
It would be helpful for reproducing this on my machine.

@amit-chaudhari1 amit-chaudhari1 self-assigned this Jul 7, 2024
@dominicletz
Copy link
Author

Should be easy to reproduce with this: Earmark.as_ast("\\[{:}")

@RobertDober
Copy link
Collaborator

@amit-chaudhari1 I missed the bug report in the discussion, shall I close #501 , which is a duplicate, or would you prefer to close thi?

@amit-chaudhari1
Copy link
Collaborator

I'll close this as duplicate.

@RobertDober
Copy link
Collaborator

ok I am on it then ...

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

No branches or pull requests

3 participants