Skip to content

Commit ccb6566

Browse files
committed
Elixir: Fix empty comment + add test for issue #775
1 parent 2e637f0 commit ccb6566

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

components/prism-elixir.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Prism.languages.elixir = {
33
// Negative look-behind is needed to avoid highlighting markdown headers in
44
// multi-line doc strings
55
'comment': {
6-
pattern: /([^#])#(?![{#]).*/,
7-
lookbehind: true
6+
pattern: /(^|[^#])#(?![{#]).*/m,
7+
lookbehind: true
88
},
99
// ~r"""foo""", ~r'''foo''', ~r/foo/, ~r|foo|, ~r"foo", ~r'foo', ~r(foo), ~r[foo], ~r{foo}, ~r<foo>
1010
'regex': /~[rR](?:("""|'''|[\/|"'])(?:\\.|(?!\1)[^\\])+\1|\((?:\\\)|[^)])+\)|\[(?:\\\]|[^\]])+\]|\{(?:\\\}|[^}])+\}|<(?:\\>|[^>])+>)[uismxfr]*/,

components/prism-elixir.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/languages/elixir/issue775.test

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@doc """
2+
## Parameters
3+
"""
4+
5+
----------------------------------------------------
6+
7+
[
8+
["attribute", "@doc"],
9+
["string", [
10+
"\"\"\"\r\n## Parameters\r\n\"\"\""
11+
]]
12+
]
13+
14+
----------------------------------------------------
15+
16+
Ensures that markdown headers are not highlighted as comments inside strings.
17+
See #775 for details.

0 commit comments

Comments
 (0)