-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite using sublime-syntax format #108
Comments
I would very much like to contribute to this. Will work on it right now and report back if I could make progress. |
Can we also add support for blocks highlighted as JavaScript by default and blocks highlighted as markdown by default? |
The current core HTML syntax definition uses the new Also, I don't know much about Vue in general or this syntax in particular, but if this syntax definition is basically HTML extended with additional features, then it might be possible to use my YAML Macros package to directly extend the core HTML syntax in a forward-compatible manner. That way, the Vue syntax could avoid reimplementing HTML itself. An example (implementing JSX by extending the core JavaScript package) can be seen here. |
@Thom1729 I've made a little bit of progress. I discovered In fact, I tried various methods which worked with less success and am taking this direction right now which seems to be working %YAML 1.2
---
name: Vue Component
file_extensions: [vue]
scope: source.vue
contexts:
main:
- match: '<template>'
scope: text.html.basic
push:
- meta_scope: text.html.basic
- match: '</template>'
pop: true
- include: scope:text.html.basic
- match: '{{'
push:
- meta_scope: source.js
- match: '}}'
pop: true
- include: scope:source.js
- match: '<style>'
push:
- meta_scope: source.css
- match: '</style>'
pop: true
- include: scope:source.css
- match: '<script>'
push:
- meta_scope: source.js
- match: '</script>'
pop: true
- include: scope:source.js I noticed that we can |
@Thom1729 I probably would clarify that vue template syntax isn't 100% html or JSX. For example: <div>
{{ foo * 10 + 'hi' }}
<span
v-text="foo * 10 + 'hi'"
:id="foo + 'baz'"
@click="onClick('hello')">
Hello
</span>
</div> We need to have some parts as JavaScript like |
The issue with The old way of dealing with this is The new way is |
@Thom1729 I actually had some other issues with I don't think we need toextend and add to the JS/CSS/etc, and will definitely switch them to |
I'm not familiar with reStructuredText, but here's an example of how that could go wrong:
The remainder of the file will be highlighted as CSS because the
The HTML syntax wants the closing
I'm not sure what you mean. Just like the HTML syntax supports embedding several other syntaxes, you can write rules to embed as many syntaxes as you like under basically whatever conditions you like. As a bonus, it doesn't bloat the syntax, and you don't have to mess around with |
Marking this issue closed 😄 Closed in #109 |
The current highlight is adapted from the ST2 HTML syntax, originally written in the
tmlanguage
format and compiled from YAML.ST3 now supports its own
sublime-syntax
format and ideally this package should be rewritten based on the new HTML syntax in ST3.This is an open call if anyone wants to take a stab at it - I have included a samples directory to verify basic highlighting behavior. Documentation for ST3 syntax definitions are here.
The text was updated successfully, but these errors were encountered: