diff --git a/messages.json b/messages.json index ec9077b6..55d95510 100644 --- a/messages.json +++ b/messages.json @@ -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" } diff --git a/messages/3.1.8.md b/messages/3.1.8.md new file mode 100644 index 00000000..cebd2cb1 --- /dev/null +++ b/messages/3.1.8.md @@ -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 diff --git a/plugins/headings/common.py b/plugins/headings/common.py index f8a1b01d..d23249e2 100644 --- a/plugins/headings/common.py +++ b/plugins/headings/common.py @@ -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) diff --git a/plugins/headings/style.py b/plugins/headings/style.py index 72b94761..32eb0fb2 100644 --- a/plugins/headings/style.py +++ b/plugins/headings/style.py @@ -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 @@ -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") diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 99a1cd2d..f9eb9cab 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/tests/syntax_test_markdown.md b/tests/syntax_test_markdown.md index 6e466e92..9e463855 100644 --- a/tests/syntax_test_markdown.md +++ b/tests/syntax_test_markdown.md @@ -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" @@ -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