This would significantly reduce code duplication. Here is the basic idea illustrated for mathjax
in the template.
{{#mathjax}} MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\(','\)']]} }); {{/mathjax}}
I can define this as a partial
and then use it inside any of the main templates by invoking it as
{{> mathjax}}
A major advantage of this approach is that if I were to update code involving mathjax
, I would only have to update the partial
.
Here is a list of partials that I might want to use
I can pretty much define even the main themes as partials. I need to think this idea through in detail before I implement it. Maybe for starters, just implement one partial and see how it works.
I need to remember to create a list of partials to be passed to whisker.render
The highlight.js
partial would be
hljs.initHighlightingOnLoad();
I can read the correct partial to use by setting syntax = readLines(highlighter)
and passing it to whisker.render
as partials = list(syntax = syntax)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.