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
Markup: Added support type="text/plain" scripts #2442
base: master
Are you sure you want to change the base?
Markup: Added support type="text/plain" scripts #2442
Conversation
I wonder if maybe this code should be moved into a "Vue" language? Bot hasn't spoken yet, but this seems like a lot of code to add to the core language for a non-default use case. |
JS File Size Changes (gzipped)A total of 4 files have changed, with a combined diff of +623 B (+12.0%).
|
Bot has spoken and it doesn't look good. Maybe we could make |
Yeah, the issue isn't the function as a whole; it's the extra logic required to support this use case. I don't know if I have a solution off the top tho. |
The new function is basically a generalization of the old one. I could factor out the code that generates the attribute loop (= the new generalization) and replace it with a function. That could work. I'll look for a solution tomorrow. |
Hmmm. Markup still gains about 200B but I don't think that I can scrap off some more. |
components.json
Outdated
"markup-attributes": { | ||
"title": "Markup attributes", | ||
"require": "markup", | ||
"owner": "RunDevelopment" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If what we're doing now is designed primarily for Vue, would it be worth just making this a full-fledged Vue language for Vue SFCs? If we need this more generally for multiple languages, we can extract it then, but markup-attributes
isn't terribly clear as to what the languages actually does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the modification it makes to markup justifies it being a "language". It would be kinda weird if Vue added support for plain text scripts in HTML. Honestly, the whole thing should be split even further: 1 "language" with just the attributes function and 1 language that adds support for plain text scripts.
Also, it's not like the whole thing is useful for just Vue and HTML. ASP.net could also profit from it but I'll need to make some more adjustments for this.
but markup-attributes isn't terribly clear as to what the languages actually does.
True. I can't think of a better name thou...
This adds support for properly unhighlighted
<script type="text/plain">
regions:The main reason I implemented this isn't
text/plain
. It's Vue (#1665).Vue supports embedded
script
andstyle
tags with languages other than Javascript and CSS. It differentiates the languages based on alang
attribute.The problem here is that the
lang
attribute can be anywhere in the list of attributes. So I changed theaddInlined
function to support arbitrary attributes as additional conditions. Example:It supports multiple attributes and will generate a regex that only matches tags that fit all criteria.
After this and #1991 are through, I can implement Vue.