Comments (5)
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.
Can you provide an example of broken Markdown highlighting?
from babel-sublime.
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.
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.
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)
- Babel issue HOT 1
- Inline comments breaking if comment begins with @ symbol HOT 5
- Version 11 broke syntax highlighting. HOT 15
- Object keys highlighting slightly incorrect in recent release HOT 5
- Sublime 4 Crashing HOT 4
- Possible highlighting error using a nested ternary HOT 3
- Highlighting error not using parentheses inside an if condition HOT 7
- Error loading syntax file: 'Packages/Babel/JavaScript (Babel).sublime-syntax' HOT 18
- ST4 Autocomplete does not consider state variables defined in a map HOT 1
- Missing Babel option in syntax selector. HOT 2
- Highlighting of `filter` in `styled-components` seems to break— HOT 3
- css Styled Component helper utility improperly highlighted HOT 3
- Functions with parameters on multiple lines are not highlighted properly. HOT 1
- JS #myPrivateClassMethod() breaks syntax highlighting HOT 6
- Object keys are now red instead of intended yellow on Monokai HOT 2
- Sublime 4149 generates "Error loading syntax file[...]: no such target" pop-up for "JavaScript (Babel)" HOT 3
- Interface in extends class is not well Colored HOT 4
- Object literal property has incorrect color in Sublime 4169
- support html`<b>babel</b>` html syntax in templates HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babel-sublime.