Skip to content

Commit

Permalink
[Markdown] allow HTML and images inside links
Browse files Browse the repository at this point in the history
  • Loading branch information
keith-hall committed Feb 22, 2017
1 parent 867b093 commit 6724234
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Markdown/Markdown.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ contexts:
link-inline-link-text:
- meta_scope: meta.link.inline.markdown
- meta_content_scope: string.other.link.title.markdown
- include: link-text
- include: link-text-allow-image
- match: \]
scope: punctuation.definition.string.end.markdown
pop: true
Expand Down Expand Up @@ -510,7 +510,7 @@ contexts:
link-ref-link-text:
- meta_scope: meta.link.reference.markdown
- meta_content_scope: string.other.link.title.markdown
- include: link-text
- include: link-text-allow-image
- match: \]
scope: punctuation.definition.string.end.markdown
pop: true
Expand Down Expand Up @@ -540,7 +540,7 @@ contexts:
link-ref-literal-link-text:
- meta_scope: meta.link.reference.literal.markdown
- meta_content_scope: string.other.link.title.markdown
- include: link-text
- include: link-text-allow-image
- match: \]
scope: punctuation.definition.string.end.markdown
pop: true
Expand Down Expand Up @@ -630,6 +630,7 @@ contexts:
- include: scope:text.html.basic
link-text:
- include: escape
- include: ampersand
- include: raw
- match: \[ # nested square brackets are allowed
push:
Expand All @@ -639,3 +640,8 @@ contexts:
- include: bold
- include: italic
- include: hard-line-break
- include: scope:text.html.basic
link-text-allow-image:
- include: link-text
- include: image-inline
- include: image-ref
42 changes: 42 additions & 0 deletions Markdown/syntax_test_markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -1000,3 +1000,45 @@ _foo [**bar**](/url)_
| ^ punctuation.definition.italic.end
| ^^ punctuation.definition.bold.begin
| ^^ punctuation.definition.bold.end


1. Open `Command Palette` using menu item `Tools → Command Palette...`
|^ markup.list.numbered punctuation.definition.list_item
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered meta.paragraph.list markup.raw.inline
2. Choose `Package Control: Install Package`

[**Read more →**][details]
|^^ punctuation.definition.bold.begin
| ^^^^^^^ constant.character.entity.html
| ^^ punctuation.definition.bold.end
| ^^^^^^^ constant.other.reference.link

[Read more →][details]
| ^^^^^^^ constant.character.entity.html
| ^^^^^^^ constant.other.reference.link

[Read more <span style="font-weight: bold;">&#8594;</span>][details]
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.other.link.title
| ^^^^^^^^^^^^^^^^^^ source.css
| ^^^^^^^ constant.character.entity.html
| ^^^^^^^ constant.other.reference.link

[![Cool ★ Image - Click to Enlarge][img-example]][img-example]
|^ punctuation.definition.image.begin
| ^^^^^^^^^^^ constant.other.reference.link
| ^ punctuation.definition.string.end
| ^^^^^^^^^^^ constant.other.reference.link

[![Cool ★ Image - Click to Enlarge](http://www.sublimetext.com/anim/rename2_packed.png)](http://www.sublimetext.com/anim/rename2_packed.png)
|^ punctuation.definition.image.begin
| ^ punctuation.definition.metadata.begin
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image
| ^ punctuation.definition.metadata.end
| ^ punctuation.definition.metadata.begin
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link
| ^ punctuation.definition.metadata.end

[img-example]: http://www.sublimetext.com/anim/rename2_packed.png
|^^^^^^^^^^^ meta.link.reference.def constant.other.reference.link
| ^ punctuation.separator.key-value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link

0 comments on commit 6724234

Please sign in to comment.