-
Notifications
You must be signed in to change notification settings - Fork 0
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
Clean up "html" pseudo-mode hacks #12247
Comments
Comment by peterflynn Not part of Sprint 21 |
Comment by pthiess reviewed, |
Comment by pthiess Made it a medium priority, pending further review |
Comment by DennisKehrig Actually the "xml" mode would already register a "text/html" mode:
But it's already taken by "htmlmixed":
So there's a conflict here. |
Comment by DennisKehrig Regarding using "html" as the MIME mode, either this was overlooked or MIME modes don't need a slash, but the "gfm" mode does this:
This might indicate we could just use "html" as a MIME mode, requiring fewer changes indeed. However, we'd still need to map the mode "html" for the language "HTML" to itself, as we now do with "xml". The latter currently doesn't even have an effect, that's just a preparation for when we remove the hack in |
Comment by DennisKehrig Regarding a) - how are we leaving anything exposed there? Nobody tells HTMLUtils to do something with "xml", it just does this internally, right? |
Issue by peterflynn
Wednesday Feb 27, 2013 at 00:34 GMT
Originally opened as adobe/brackets#2965
We have a number of hacks to deal with the fact that the tokens "htmlmixed" mode generates for HTML content actually say their mode is "xml". (We care about the mode of individual tokens so as to distinguish JS, CSS, etc. that might be embedded in the HTML).
_setLanguageForMode("html", html)
at bottom)html._setLanguageForMode("xml", html)
at bottom -- the only usage of this mechanism).There are several ways we could fix this & remove those hacks:
a) Make HTMLUtils and other code handle seeing "xml" tokens. Dennis pointed out that much of the functionality there should be callable on any XML content anyway (e.g. getTagAttributes(), getTagInfo()). Cons: tokens remain seemingly confusing; would never be able to distinguish any sort of non-HTML XML embedded inside HTML; we're basically leaving an implementation detail of htmlmixed mode exposed; may break extensions.
b) Change htmlmixed to pull in XML mode by a mimetype alias, which is increasingly becoming the "official" way to reference modes with non-default configurations. So instead of
CodeMirror.getMode(config, {name: "xml", htmlMode: true})
it would doCodeMirror.getMode(config, "text/html")
). But we'd either have to change all our code that looks for a mode name "html" to look for "text/html" instead, or use "html" as the mime name even though it's not in mimetype format. Cons: requires CodeMirror changes; may involve nonstandard usage of CM's mimetype facility.For original discussion, see these threads:
The text was updated successfully, but these errors were encountered: