-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
specify 'other' code in liquid codeblocks as markup #2919
Conversation
@JaKXz Could you please explain the issue this PR is solving and give an example? |
Hey @RunDevelopment -- sorry for the empty description, thanks for the reply. For the purposes of syntax highlighting I think we're happy to think of the "other" elements in a liquid codeblock as but the same codeblock with Happy to discuss further, please let me know what you think! |
I see. In that case, Liquide deserves a bit of an overhaul. Twig's approach with an Markup templating can be used like this:components.json
@@ -731,6 +731,7 @@
"liquid": {
"title": "Liquid",
+ "require": "markup-templating",
"owner": "cinhtau"
}, components/prism-liquid.js
@@ -1,4 +1,8 @@
Prism.languages.liquid = {
+ 'delimiter': {
+ pattern: /^\{(?:\{\{|[%\{])-?|-?(?:\}\}|[%\}])\}$/,
+ alias: 'punctuation'
+ },
'keyword': /\b(?:comment|endcomment|if|elsif|else|endif|unless|endunless|for|endfor|case|endcase|when|in|break|assign|continue|limit|offset|range|reversed|raw|endraw|capture|endcapture|tablerow|endtablerow)\b/,
'number': /\b0b[01]+\b|\b0x(?:\.[\da-fp-]+|[\da-f]+(?:\.[\da-fp-]+)?)\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?[df]?/i,
'operator': {
@@ -10,3 +14,12 @@ Prism.languages.liquid = {
lookbehind: true
}
};
+
+Prism.hooks.add('before-tokenize', function (env) {
+ var liquidPattern = /\{(?:%[\s\S]*?%|\{\{[\s\S]*?\}\}|\{[\s\S]*?\})\}/g;
+ Prism.languages['markup-templating'].buildPlaceholders(env, 'liquid', liquidPattern);
+});
+
+Prism.hooks.add('after-tokenize', function (env) {
+ Prism.languages['markup-templating'].tokenizePlaceholders(env, 'liquid');
+}); This works okay: However, this is only a quick draft I did in literally 5 minutes and I have never worked with Liquid before. This still needs testing, testing, and then some more testing. Would you like to do this? |
Whoa, that's pretty cool! I'd be happy to try that out and report back. In the meantime, do you think we could merge this as a stopgap [and that would also give us a better control/baseline to compare against]? I'm not sure why CI is half-passing though... :\ |
Sorry but I'm inclined to say no. The reason being, it doesn't work. Liquid highlights all
Lint and tests pass. Liquid is poorly tested rn, so it's not surprising that they pass. The reason the CI fails is that you forgot to update the minified files. Just run And yes, we commit the build... |
No description provided.