Skip to content

Commit

Permalink
Fix for empty hashbangs
Browse files Browse the repository at this point in the history
  • Loading branch information
ttscoff committed Oct 19, 2021
1 parent fc33b3c commit f6db3c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mdless/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ def convert_markdown(input)
else
first_line = m[3].to_s.split(/\n/)[0]

if first_line =~ /^\s*#!/
if first_line =~ /^\s*#!.*\/.+/
shebang = first_line.match(/^\s*#!.*\/(?:env )?([^\/]+)$/)
language = shebang[1]
code_block = m[3]
Expand Down
4 changes: 4 additions & 0 deletions test/codeblocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ date: yesterday
Code block tests
================

```
#!
```

Just some text before we get started.

![Image test](https://raw.githubusercontent.com/eddieantonio/i/master/imgcat.png)<br/>after a break
Expand Down

0 comments on commit f6db3c3

Please sign in to comment.