Browse Source

Markdown.pl: allow "stuff" on end of ``` line

Some @#%^@! are doing something like this:

  ```shell script
  blah blah blah
  ```

That was not previously matching because only one optional "word"
was allowed trailing the opening "```" characters.

The single optional "word" is supposed to be a file extension type.
Clearly ".shell script" is _not_ a file extension!

Relax the rule somewhat.  Multiple "words" are now allowed but only
the first will ever participate in choosing the syntax highlighting
(which currently never happens anyway).

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
master
Kyle J. McKay 3 years ago
parent
commit
857a411dc5
  1. 2
      Markdown.pl

2
Markdown.pl

@ -1131,7 +1131,7 @@ sub _HashBTCodeBlocks {
$text =~ s{
(?:(?<=\n)|\A)
([ ]{0,$less_than_indent})``(`+)[ \t]*(?:([\w.+-]+[#]?)[ \t]*)?\n
([ ]{0,$less_than_indent})``(`+)[ \t]*(?:([\w.+-]+[#]?)(?:[ \t][ \t\w.+-]*)?)?\n
( # $4 = the code block -- one or more lines, starting with ```
(?:
.*\n+

Loading…
Cancel
Save