Giter Club home page Giter Club logo

Comments (5)

Thom1729 avatar Thom1729 commented on May 27, 2024 1

Yeah, that's going to run into problems in a wide variety of situations, and I don't think this syntax could accommodate them all even if it were a good idea. I would open an issue on the tracker, but the project looks abandoned.

If you want Markdown with more languages, you can extend the core syntax, e.g.:

%YAML 1.2
---
name: Customized Markdown
scope: text.html.markdown
extends: Packages/Markdown/Markdown.sublime-syntax
contexts:
  fenced-code-block:
     - meta_prepend: true
     - match: |-
          (?x)
           {{fenced_code_block_start}}
           ((?i:vue))
           {{fenced_code_block_trailing_infostring_characters}}
       captures:
         0: meta.code-fence.definition.begin.vue.markdown-gfm
         2: punctuation.definition.raw.code-fence.begin.markdown
         5: constant.other.language-name.markdown
       embed: scope:text.html.vue
       embed_scope: markup.raw.code-fence.vue.markdown-gfm
       escape: '{{code_fence_escape}}'
       escape_captures:
         0: meta.code-fence.definition.end.vue.markdown-gfm
         1: punctuation.definition.raw.code-fence.end.markdown

Save the above in your User directory as “Customized Markdown.sublime-syntax” and it will highlight Vue code blocks (if you have the Vue package installed). Customize/extend as needed for other languages.

from babel-sublime.

Thom1729 avatar Thom1729 commented on May 27, 2024

Can you provide an example of broken Markdown highlighting?

from babel-sublime.

simov avatar simov commented on May 27, 2024

md-js

Seems like identifiers, parentheses, comments and probably others. Note that I've been using this highlighter for years in that markdown syntax and I've never seen so many leaks outside of the fenced code blocks. In fact I can't remember seeing any.

Nothing changed on my end other than using the latest stable syntax from this package and that I switched over to ST4. My only assumption so far is that this have something to do with the Babel syntax itself because it is being included inside the markdown fenced code blocks and leaks out.

from babel-sublime.

Thom1729 avatar Thom1729 commented on May 27, 2024

I can't reproduce.

Are you using a third-party Markdown syntax? If so, it looks like a bug in that syntax. The correct way to embed a language in a code block is via embed/escape; this ensures that the host language can handle the closing backticks before the embedded language even sees them. (It also uses a lot less memory than with_prototype and avoids some other problems as well).

If it is a bug with a third-party Markdown syntax, I don't think it would make sense to fix it here.

from babel-sublime.

simov avatar simov commented on May 27, 2024

I use this one https://github.com/jonschlinkert/sublime-markdown-extended and it looks like this:

- match: '(```|~~~|{%\s*highlight)\s*(javascript|js)\s*((?:linenos\s*)?%})?$'
  captures:
    1: punctuation.definition.fenced.markdown
    2: variable.language.fenced.markdown
    3: punctuation.definition.fenced.markdown
  push:
    - meta_scope: markup.raw.block.markdown markup.raw.block.fenced.markdown
    - meta_content_scope: source.js
    - match: '(```|~~~|{%\s*endhighlight\s*%})\n'
      captures:
        1: punctuation.definition.fenced.markdown
        2: variable.language.fenced.markdown
        3: punctuation.definition.fenced.markdown
      pop: true
    - include: scope:source.js

I've seen the constructs you are talking about in Sublime's docs, but this syntax is pretty old and probably those constructs were not available at that time. In any case if that's not an issue with this syntax then feel free to close this issue. Thanks.

from babel-sublime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.