Skip to content

Commit

Permalink
Elixir: Fix empty comment + add test for issue #775
Browse files Browse the repository at this point in the history
  • Loading branch information
Golmote committed Sep 22, 2015
1 parent 2e637f0 commit ccb6566
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
4 changes: 2 additions & 2 deletions components/prism-elixir.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Prism.languages.elixir = {
// Negative look-behind is needed to avoid highlighting markdown headers in
// multi-line doc strings
'comment': {
pattern: /([^#])#(?![{#]).*/,
lookbehind: true
pattern: /(^|[^#])#(?![{#]).*/m,
lookbehind: true
},
// ~r"""foo""", ~r'''foo''', ~r/foo/, ~r|foo|, ~r"foo", ~r'foo', ~r(foo), ~r[foo], ~r{foo}, ~r<foo>
'regex': /~[rR](?:("""|'''|[\/|"'])(?:\\.|(?!\1)[^\\])+\1|\((?:\\\)|[^)])+\)|\[(?:\\\]|[^\]])+\]|\{(?:\\\}|[^}])+\}|<(?:\\>|[^>])+>)[uismxfr]*/,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-elixir.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions tests/languages/elixir/issue775.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@doc """
## Parameters
"""

----------------------------------------------------

[
["attribute", "@doc"],
["string", [
"\"\"\"\r\n## Parameters\r\n\"\"\""
]]
]

----------------------------------------------------

Ensures that markdown headers are not highlighted as comments inside strings.
See #775 for details.

0 comments on commit ccb6566

Please sign in to comment.