Skip to content

Latest commit

 

History

History
106 lines (74 loc) · 5.05 KB

Templates.md

File metadata and controls

106 lines (74 loc) · 5.05 KB

How to use templates with YARLE

You can control the Markdown output generated by YARLE by using a custom template file like the one below, which is similar to YARLE's default template.

Calling the template

To use a custom template with YARLE, include the templateFile parameter in your config.json file. For example,

"templateFile": "/absolute-path-to-your-template-dir/myTemplate.tmpl"

Creating the template

A custom template file can have any file name and extension.

  • To include content, specify its block. A template block has two basic elements:

    • A "block" tag that encloses the type of content it will produce and the formatting around the content (e.g. # for a header, or --- for a separator).
    • The "content" tag inside the block, such as {tags} and {content}. Every content tag must be surrounded by its block tags.
  • To exclude a type of content, don't include that block. For example, to create Markdown files with only the title and the content, define a template with these blocks:

{title-block}# {title}{end-title-block}

{content-block}{content}{end-content-block}

Available blocks

Name Block and content tags Description
Title {title-block}{title}{end-title-block} Note title
Tags {tags-block}{tags}{end-tags-block} Note tags
Tags as Yaml list  {tags-yaml-list-block}tags: {tags-yaml-list}{end-tags-yaml-list-block} Note tags as yaml list
Array Tags {tags-array-block}{tags-array}{end-tags-array-block} Note tags in array format (to be compatible with Obsidian's Yaml Frontmatter)
Content {content-block}{content}{end-content-block} Note content
Date of creation {created-at-block}{created-at}{end-created-at-block} Creation date of the note
Reminder Time {reminder-time-block}{reminder-time}{end-reminder-time-block} Reminder time of the note
Reminder Done Time {reminder-done-time-block}{reminder-done-time}{end-reminder-done-time-block} Reminder done time of the note
Reminder Order {reminder-order-block}{reminder-order}{end-reminder-order-block} Reminder order of the note
Last update {updated-at-block}{updated-at}{end-updated-at-block} Last updated date of the note
Source URL {source-url-block}{source-url}{end-source-url-block} Source URL from the EN metadata
Original Notebook Name {notebook-block}{notebook}{end-notebook-block} Name of the EN notebook where the note is stored
Link to the HTML file {link-to-original-block}{link-to-original}{end-link-to-original-block} Generate an HTML version of the note in the note's resource folder. A link to the HTML file is included here.
Location {location-block}{location}{end-location-block} The GPS coordinates of the location from the EN location details.

Extra template blocks if there is TOC

If a Table of contents is generated in the enex, feel free to add these blocks to the template:

Table of contents can be created in EN v10+ if you select all of your notes, then right click and choose Copy internal links then Copy app links . Then create a new note, title MUST BE: Table of Contents, and paste the internal links into the note's body. That's all.

Name Block and content tags Description
Evernote link   {evernotelink-block}{evernotelink}{end-evernotelink-block} Link to the original note in Evernote
Evernote guid   {evernoteguid-block}{evernoteguid}{end-evernoteguid-block} Guid of the original note in Evernote

Example template:

This example puts the note title at the top, preceded by #. The tags are listed next, surrounded by horizontal rules. The note content follows. Finally, the note's metadata is included, indented, at the bottom of the note. The output also includes an HTML version of the note, with a link to it in the Markdown file.

{title-block}# {title}{end-title-block}

{tags-block}
---
Tags {tags}

---
{end-tags-block}

{content-block}{content}{end-content-block}

    {created-at-block}    Created at: {created-at}{end-created-at-block}
    {updated-at-block}    Updated at: {updated-at}{end-updated-at-block}
    {source-url-block}    Source: {source-url}{end-source-url-block}
    {notebook-block}      Notebook: {notebook}{end-notebook-block}
    {location-block}    Where: {location}{end-location-block}
    {link-to-original-block}      Link to original content: {link-to-original}{end-link-to-original-block}

As a starting point, you can edit the sampleTemplate.tmpl default template. Don't forget to specify the templateFile in your config file.

Example Tags array template:

{title-block}# {title}{end-title-block}

{tags-array-block}
---
Tags {tags-array}

---
{end-tags-array-block}

{content-block}{content}{end-content-block}

{created-at-block}    Created at: {created-at}{end-created-at-block}
{updated-at-block}    Updated at: {updated-at}{end-updated-at-block}
{source-url-block}    Source: {source-url}{end-source-url-block}
{notebook-block}      Notebook: {notebook}{end-notebook-block}

Have fun! 😃