Default ability to add a language parameter to @markup
I'm trying to use prism and I need the ability to pass a language param to the code
<div>
<h3>Example</h3>
<div class="example">
{{ markup.example | safe }}
</div>
<h1>{{ state.name }}</h1>
<pre><code class="language-{{ markup.lang }}">
{{ markup.escaped }}
</code></pre>
</div>
I figured it could work something like this to make it simple.
@markup scss
...
You can already create a custom variable to pass information along to the templates if you want. Here's an example of a custom variable, custom parser and a custom template that would solve this.
Custom CSS/Comment:
// @lang scss
Custom JavaScript/Parser:
dss.parser( 'lang', function( i, line, block ) {
return line;
});
Custom HTML/Template:
<h3>Example</h3>
<div class="example">
{{ markup.example | safe }}
</div>
<h1>{{ state.name }}</h1>
<pre><code class="language-{{ lang }}">
{{ markup.escaped }}
</code></pre>
As an aside: the
@markupvariable/implementation will be changing soon (and it will actually be using a similar format to what you mocked out). The plan is to support HTML, Markdown and Jade as default markup formats instead of just HTML (like we do right now).
Example:
// @markup html
// <h1>A Header Example</h1>
// @markup jade
// h1 A Header Example
// @markup markdown
// # A Header Example
Further thought... this is definitely a custom parser situation. I'm going to write an example of how you can do this sometime over the next week but it is 100% possible to do right now if you took some time to investigate writing one yourself.
It is, I figured out how to customize it.