Skip to content

Commit

Permalink
Fix inline link reference and definition
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielelana committed Aug 17, 2014
1 parent 3ef7c8d commit 4be9c26
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions spec/features/inline_links.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Link with newline between URL and title it's ok [link](http://example.com

# This is [link](http://github.com) in a title

[Link](http://example.com) at beginning of the line. Bug: this was considered as link definition


---
Expand Down
1 change: 1 addition & 0 deletions spec/features/inline_links.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@

<span class="Special">#</span><span class="Title"> This is </span><span class="Special">[</span><span class="Underlined">link</span><span class="Special">]</span><span class="Special">(</span><span class="Underlined"><a href="http://github.com">http://github.com</a></span><span class="Special">)</span><span class="Title"> in a title</span>

<span class="Special">[</span><span class="Underlined">Link</span><span class="Special">]</span><span class="Special">(</span><span class="Underlined"><a href="http://example.com">http://example.com</a></span><span class="Special">)</span> at beginning of the line. Bug: this was considered as link definition


<span class="Identifier">---</span>
Expand Down
3 changes: 3 additions & 0 deletions spec/features/inline_references.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ breaks][]

[line breaks]: http://example.com "Yes this works"

---
The following should be supported but they are not... In GFM and Kramdown link references could omit the second pair of square brackets, with a programming language is possible to check if something between square brackets has a related link definition an so to be interpreted as link reference but here it would be impossible

[short ref]

[short
Expand Down
12 changes: 8 additions & 4 deletions spec/features/inline_references.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
.NonText { color: #8080ff; }
.Underlined { color: #c000c0; text-decoration: underline; }
.Special { color: #c000c0; }
.Identifier { color: #008080; }
-->
</style>

Expand Down Expand Up @@ -65,14 +66,17 @@

<span class="NonText">[line breaks]: <a href="http://example.com">http://example.com</a> &quot;Yes this works&quot;</span>

<span class="NonText">[short ref]</span>
<span class="Identifier">---</span>
The following should be supported but they are not... In GFM and Kramdown link references could omit the second pair of square brackets, with a programming language is possible to check if something between square brackets has a related link definition an so to be interpreted as link reference but here it would be impossible

<span class="NonText">[short</span>
<span class="NonText">ref]</span>
[short ref]

[short
ref]

<span class="NonText">[short ref]: <a href="http://example.com">http://example.com</a> &quot;No more hanging empty bracket!&quot;</span>

<span class="NonText">[a ref]</span>
[a ref]

<span class="NonText">[a ref]: <a href="http://example.com">http://example.com</a></span>
<span class="NonText"> &quot;Title on next line.&quot;</span>
Expand Down
6 changes: 2 additions & 4 deletions syntax/markdown.vim
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,8 @@ execute 'syn match markdownLinkReference '
\ . '/'
\ . '^\s\{,3}'
\ . b:markdown_syntax_square_brackets_block
\ . '\%('
\ . ':.*'
\ . '\%(\n\%\(\n\)\@!.*$\)\?'
\ . '\)\?'
\ . ':.*'
\ . '\%(\n\%\(\n\)\@!.*$\)*'
\ . '/'

syn region markdownBlockquote start=/^\s*\%(>\s\?\)\+\%(.\)\@=/ end=/\n\n/ contains=markdownBlockquoteDelimiter,@NoSpell
Expand Down

0 comments on commit 4be9c26

Please sign in to comment.