Classeur uses Handlebars, a Mustache compatible template engine, when exporting files to your disk or when publishing blog posts. Classeur lets you modify existing templates or create your own one, and have full control over the data you export.

File context

When processing a file, Handlebars receives the following context along with the template:

  "file": {
    "name": "The filename",
    "content": {
      "properties": {
        "key1": "value1",
        "key2": "value2"
      "text": "The content of your file",
      "html": "<p>The content of your file</p>"

So, for example, the following template:


will be transformed by the template engine into:

<title>The filename</title>
<body><p>The content of your file</p></body>


In addition to the default Handlebars helpers, Classeur adds its own ones.


The toYaml helper allows you to convert an object into YAML. Typically, to generate a YAML front matter from your file properties, you can prefix your template with:

{{#toYaml file.content.properties}}{{/toYaml}}

Custom helpers

If you need more control, you can always create your own helpers in the settings. For example:

Handlebars.registerHelper('transform', function (options) {
  var result = options.fn(this)
  return new Handlebars.SafeString(
    result.replace(/<pre[^>]*>/g, '<pre class="prettyprint">')
Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk