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

Fixes #501 #503

Merged
merged 2 commits into from
Jul 11, 2024
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
2 changes: 1 addition & 1 deletion lib/earmark_parser/ast/inline.ex
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ defmodule Earmark.Parser.Ast.Inline do
if match = Regex.run(@inline_ial, src) do
[match, ial] = match
{context1, ial_attrs} = parse_attrs(context, ial, lnb)
new_tags = augment_tag_with_ial(context.value, ial_attrs)
new_tags = augment_tag_with_ial(context.value, ial_attrs, match)
amit-chaudhari1 marked this conversation as resolved.
Show resolved Hide resolved
{behead(src, match), lnb, set_value(context1, new_tags), use_linky?}
end
end
Expand Down
13 changes: 7 additions & 6 deletions lib/earmark_parser/helpers/ast_helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@ defmodule Earmark.Parser.Helpers.AstHelpers do
end

@doc false
def augment_tag_with_ial(tags, ial)

def augment_tag_with_ial([{t, a, c, m} | tags], atts) do
[{t, merge_attrs(a, atts), c, m} | tags]
def augment_tag_with_ial(tags, ial, src)
def augment_tag_with_ial([{t, a, c, m}|tags], atts, _src) do
[{t, merge_attrs(a, atts), c, m}|tags]
end

def augment_tag_with_ial([], _atts) do
def augment_tag_with_ial([], _atts, _src) do
[]
end
def augment_tag_with_ial([any], _atts, src) do
[any <> src]
amit-chaudhari1 marked this conversation as resolved.
Show resolved Hide resolved
end

@doc false
def code_classes(language, prefix) do
Expand Down
11 changes: 11 additions & 0 deletions test/regressions/i154_crash_on_symbolic_input_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
defmodule Test.Regressions.I154CrashOnSymbolicInputTest do
use ExUnit.Case

test "do not crash here" do
md = "\\[{:}"
html = "<p>\n[{:}</p>\n"
assert Earmark.as_html(md) == {:ok, html, []}
end

end
# SPDX-License-Identifier: Apache-2.0
Loading