pragdave/earmark

Exception raised with Earmark.as_html!/2

Closed this issue · 14 comments

Hello,

Since upgrading from v1.4.15 (with all versions up to) v1.4.19 I get this error when using Earmark.as_html!/2

** (exit) an exception was raised:
    ** (FunctionClauseError) no function clause matching in MapSet.union/2
        (elixir 1.13.1) lib/map_set.ex:372: MapSet.union([], [])
        (earmark_parser 1.4.19) lib/earmark_parser/context.ex:64: EarmarkParser.Context._merge_messages/2
        (earmark_parser 1.4.19) lib/earmark_parser/context.ex:55: EarmarkParser.Context._merge_contexts/2
        (earmark_parser 1.4.19) lib/earmark_parser/context.ex:47: EarmarkParser.Context.prepend/3
        (earmark_parser 1.4.19) lib/earmark_parser/ast_renderer.ex:23: EarmarkParser.AstRenderer._render/3
        (earmark_parser 1.4.19) lib/earmark_parser.ex:494: EarmarkParser.as_ast/2
        (earmark 1.4.19) lib/earmark/internal.ex:42: Earmark.Internal.as_html/2
        (earmark 1.4.19) lib/earmark/internal.ex:48: Earmark.Internal.as_html!/2

Thanks.

Was just going to report this. EarmarkParser version 1.4.19 released today crashes on all APIs. It appears EarmarkParser changed an API to use MapSets without co-ercing inbound options using the old list format.

Repro:

Mix.install(earmark_parser: "== 1.4.19", earmark: "== 1.4.19")
Earmark.as_html!("oops")

Ok that may explains why I couldn't totally fix it by reverting to a previous version. In v1.4.15 I get an empty string and an exception in all superior versions.

So if the bug is not strictly in Earmark I guess I'll close this issue.

Edit:
After testing, pinning EarmarkParser to the previous version while updating Earmark works for me (I'm only using as_html/2 so I can't comment for the rest).

{:earmark_parser, "1.4.18"},
{:earmark, "1.4.19"}

I think though this is a bug in EarmarkParser, or at least a breaking contract more worth of a minor version bump, we should keep this as an open issue since there is a mitigation: changing the dependency version of this library from {:earmark_parser, ">= 1.4.18"} to {:earmark_parser, ">= 1.4.18 and != 1.4.18"} will prevent quite a few breaking builds I suspect.

I re-opened for visibility and opened a corresponding issue on earmark_parser board. Let's see how this goes.

I appologize, releasing EarmarkParser I did not realize that Earmark will fetch the newest version I will fix this in an Earmark Release ASAP

Release fix in 1.4.20

Thanks.

We're somehow tripping over this error now, running earmark 1.4.20 and earmark_parser 1.4.19. It appears there is no earmark_parser 1.4.20 on Hex; should there be?

@simoncocking it looks like 1.4.20 got un-released 5 days ago? https://hex.pm/packages/earmark_parser/audit_logs

Well that'll certainly do it!! 😅

We're somehow tripping over this error now, running earmark 1.4.20 and earmark_parser 1.4.19. It appears there is no earmark_parser 1.4.20 on Hex; should there be?

no

@simoncocking it looks like 1.4.20 got un-released 5 days ago? https://hex.pm/packages/earmark_parser/audit_logs

YHS messed up big and is working hard to get 1.5 out

YHS messed up big and is working hard to get 1.5 out

Took me quite a while to figure out what YHS meant 😂 Appreciate your hard work, from our perspective there's no urgency as we're able to roll back to 1.4.15 and await the real fix 😉

@simoncocking good to know