Skip to content

Commit

Permalink
Merge branch 'st3-develop' into st3176
Browse files Browse the repository at this point in the history
  • Loading branch information
deathaxe committed Nov 23, 2022
2 parents 5873d39 + 0b18708 commit 481821e
Show file tree
Hide file tree
Showing 6 changed files with 170 additions and 10 deletions.
3 changes: 2 additions & 1 deletion messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@
"3.1.4": "messages/3.1.4.md",
"3.1.5": "messages/3.1.5.md",
"3.1.6": "messages/3.1.6.md",
"3.1.7": "messages/3.1.7.md"
"3.1.7": "messages/3.1.7.md",
"3.1.8": "messages/3.1.8.md"
}
15 changes: 15 additions & 0 deletions messages/3.1.8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# MarkdownEditing 3.1.8 Changelog

Your _MarkdownEditing_ plugin is updated. Enjoy new version. For any type of
feedback you can use [GitHub issues][issues].

## Bug Fixes

* Fix GFM auto-link termination
* Add support for pandoc attributes in reference definitions (#712)

## New Features

## Changes

[issues]: https://github.com/SublimeText-Markdown/MarkdownEditing/issues
4 changes: 3 additions & 1 deletion plugins/headings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ class MdeUnsavedViewNameSetter(MdeViewEventListener):
MAX_NAME = 50

def on_modified(self):
if self.view.file_name() is not None or not self.view.settings().get("set_unsaved_view_name", True):
if self.view.file_name() is not None or not self.view.settings().get(
"set_unsaved_view_name", True
):
return

name = first_heading_text(self.view)
Expand Down
5 changes: 2 additions & 3 deletions plugins/headings/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def on_load(self):

def on_pre_save(self):
self.auto_detect_heading_style()
if self.view.settings().get("mde.auto_match_heading_hashes", False):
self.view.run_command("mde_match_heading_hashes")

def auto_detect_heading_style(self):
view = self.view
Expand All @@ -86,6 +88,3 @@ def auto_detect_heading_style(self):
view.settings().set("mde.match_heading_hashes", num_trailing / num_leading > 0.5)
else:
view.settings().erase("mde.match_heading_hashes")

if view.settings().get("mde.auto_match_heading_hashes", False):
view.run_command("mde_match_heading_hashes")
32 changes: 27 additions & 5 deletions syntaxes/Markdown.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -2431,25 +2431,44 @@ contexts:
3: punctuation.definition.reference.end.markdown
4: punctuation.separator.key-value.markdown
push:
- link-def-end
- link-def-meta
- link-def-attr
- link-def-title
- link-def-url

link-def-end:
link-def-meta:
- meta_include_prototype: false
- meta_scope: meta.link.reference.def.markdown
- include: immediately-pop

link-def-attr:
- match: \{
scope: punctuation.definition.attributes.begin.markdown
set: link-def-attr-body
- match: ^(?!\s*{)|(?=\S)
pop: true

link-def-attr-body:
- meta_scope: meta.attributes.markdown
- include: tag-attributes

link-def-title:
- match: ^(?!\s*["'(])
pop: true
- match: (?=["'(])
set:
- expect-eol
- expect-attr-or-eol
- link-title
- match: (?=\{)
pop: true
- match: \S.+
scope: invalid.illegal.expected-eol.markdown

expect-attr-or-eol:
- match: (?=\{)
pop: true
- include: expect-eol

link-def-url:
- match: <
scope: punctuation.definition.link.begin.markdown
Expand Down Expand Up @@ -3206,6 +3225,7 @@ contexts:
scope: invalid.illegal.attribute-name.markdown

tag-attr-meta:
- meta_include_prototype: false
- meta_scope: meta.attribute-with-value.markdown
- include: immediately-pop

Expand Down Expand Up @@ -3283,6 +3303,7 @@ contexts:
- link-url-scheme-separator
# Github Flavoured Markdown
# After a valid domain, zero or more non-space non-< characters may follow
# https://github.github.com/gfm/#autolinks-extension-
- match: (?:(?:https|http|ftp)(://)|www\.)[\w-]+
captures:
1: punctuation.separator.path.markdown
Expand Down Expand Up @@ -3311,14 +3332,15 @@ contexts:
# 3. Trailing punctuation (specifically, ?, !, ., ,, :, *, _, and ~) will not
# be considered part of the autolink, though they may be included in the
# interior # of the link
- match: (?=(?:\)|(?:{{html_entity}})*)[?!.,:*_~]*[\s<])
# Note: contains some empirical (undocumented) punctuation such as ;, ', "
- match: (?=(?:\)|(?:{{html_entity}})*)[?!.,:;*_~'"]*[\s<])
pop: true
- include: autolink-inet-common

autolink-inet-group:
- match: \)
pop: true
- match: (?=(?:{{html_entity}})*[?!.,:*_~]*[\s<])
- match: (?=(?:{{html_entity}})*[?!.,:;*_~'"]*[\s<])
pop: true
- include: autolink-inet-common

Expand Down
121 changes: 121 additions & 0 deletions tests/syntax_test_markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -2508,6 +2508,41 @@ Foo
| ^ punctuation.separator.key-value.markdown
| ^^^^ markup.underline.link.markdown

## https://custom-tests/link-reference-definitions/with-attributes

[link]: /url {#id .class width=30}
| ^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.markdown meta.attributes.markdown

[link]: /url (description) {#id .class width=30}
| ^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.markdown meta.attributes.markdown

[link]: /url "description" {#id .class width=30}
| ^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.markdown meta.attributes.markdown

[link]:
/url
{#id .class width=30}
| ^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.markdown meta.attributes.markdown

[link]:
/url

{#id .class width=30}
| ^^^^^^^^^^^^^^^^^^^^^ - meta.link - meta.attributes

[link]:
/url
"description"
{#id .class width=30}
| ^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.def.markdown meta.attributes.markdown

[link]:
/url
"description"

{#id .class width=30}
| ^^^^^^^^^^^^^^^^^^^^^ - meta.link - meta.attributes

## https://custom-tests/link-reference-definitions/in-block-quotes

> [foo]: /url "description"
Expand Down Expand Up @@ -7358,6 +7393,92 @@ Visit www.commonmark.org/a.b.
| ^ - markup.underline.link
| ^ punctuation.separator.path.markdown
Visit www.commonmark.org?
| ^ - markup.underline.link
| ^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet.markdown markup.underline.link
| ^ - markup.underline.link
Visit www.commonmark.org!
| ^ - markup.underline.link
| ^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet.markdown markup.underline.link
| ^ - markup.underline.link
Visit www.commonmark.org:
| ^ - markup.underline.link
| ^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet.markdown markup.underline.link
| ^ - markup.underline.link
Visit www.commonmark.org;
| ^ - markup.underline.link
| ^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet.markdown markup.underline.link
| ^ - markup.underline.link
Visit www.commonmark.org*
| ^ - markup.underline.link
| ^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet.markdown markup.underline.link
| ^ - markup.underline.link
Visit www.commonmark.org_
| ^ - markup.underline.link
| ^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet.markdown markup.underline.link
| ^ - markup.underline.link
Visit www.commonmark.org~
| ^ - markup.underline.link
| ^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet.markdown markup.underline.link
| ^ - markup.underline.link
Visit 'www.commonmark.org'
| ^ - markup.underline.link
| ^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet.markdown markup.underline.link
| ^ - markup.underline.link
Visit "www.commonmark.org"
| ^ - markup.underline.link
| ^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet.markdown markup.underline.link
| ^ - markup.underline.link
Visit "www.commonmark.org/q'uo"te"
| ^ - markup.underline.link
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet.markdown markup.underline.link
| ^ - markup.underline.link
Visit www.commonmark.org=
| ^ - markup.underline.link
| ^^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet.markdown markup.underline.link
| ^ - markup.underline.link
Visit www.commonmark.org&
| ^ - markup.underline.link
| ^^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet.markdown markup.underline.link
| ^ - markup.underline.link
Visit www.commonmark.org%
| ^ - markup.underline.link
| ^^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet.markdown markup.underline.link
| ^ - markup.underline.link
Visit www.commonmark.org$
| ^ - markup.underline.link
| ^^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet.markdown markup.underline.link
| ^ - markup.underline.link
Visit www.commonmark.org#
| ^ - markup.underline.link
| ^^^^^^^^^^^^^^^^^^^ meta.paragraph meta.link.inet.markdown markup.underline.link
| ^ - markup.underline.link
www.google.com/search?q=(business'
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link
| ^ punctuation.separator.path.markdown
| ^ punctuation.separator.path.markdown
| ^ - markup.underline.link
www.google.com/search?q=(business"
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link
| ^ punctuation.separator.path.markdown
| ^ punctuation.separator.path.markdown
| ^ - markup.underline.link
www.google.com/search?q=(business))+ok
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inet.markdown markup.underline.link
| ^ punctuation.separator.path.markdown
Expand Down

0 comments on commit 481821e

Please sign in to comment.