_ideas/IDEA2.md

Rewrite Templates Using Mustache Partials

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

Highlighter Paritals

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)



ramnathv/slidify-old documentation built on May 26, 2019, 10:55 p.m.