Both sides previous revisionPrevious revisionNext revision | Previous revision |
note_templates [2022/07/09 16:46] – [Variables] dstillman | note_templates [2023/02/21 06:38] (current) – [Variables] Add hex code for new colors dstillman |
---|
Templates support basic HTML, with variables within curly brackets. Here's the default template for highlights: | Templates support basic HTML, with variables within curly brackets. Here's the default template for highlights: |
| |
<code><p>{{highlight quotes='true'}} {{citation}} {{comment}}</p></code> | <code><p>{{highlight}} {{citation}} {{comment}}</p></code> |
| |
You can see that, by default, highlight annotations are added as a single paragraph, with the highlighted text in typographic quotes followed by the citation and any comment. | You can see that, by default, highlight annotations are added as a single paragraph, with the highlighted text followed by the citation and any comment. Quotation marks are automatically added around the highlight. |
| |
If you prefer to have the highlight text in a blockquote, it's a simple change: | If you prefer to have the highlight text in a blockquote, it's a simple change: |
<code><blockquote>{{highlight}}</blockquote><p>{{citation}}</p>{{if comment}}<p>{{comment}}</p>{{endif}}</code> | <code><blockquote>{{highlight}}</blockquote><p>{{citation}}</p>{{if comment}}<p>{{comment}}</p>{{endif}}</code> |
| |
Conditionals can also be used to test for specific values. Here, text highlighted in red becomes a header, text highlighted in blue becomes a blockquote, and all other highlights use a single paragraph: | Conditionals can also be used to test for specific values. Here, text highlighted in red becomes a header without quotation marks, text highlighted in blue becomes a blockquote, and all other highlights use a single paragraph: |
| |
<code>{{if color == '#ff6666'}} | <code>{{if color == '#ff6666'}} |
<h2>{{highlight}}</h2> | <h2>{{highlight quotes='false'}}</h2> |
{{elseif color == '#2ea8e5'}} | {{elseif color == '#2ea8e5'}} |
{{if comment}}<p>{{comment}}:</p>{{endif}}<blockquote>{{highlight}}</blockquote><p>{{citation}}</p> | {{if comment}}<p>{{comment}}:</p>{{endif}}<blockquote>{{highlight}}</blockquote><p>{{citation}}</p> |
{{else}} | {{else}} |
<p>{{highlight quotes='true'}} {{citation}} {{comment}}{{if tags}} #{{tags join=' #'}}{{endif}}</p> | <p>{{highlight}} {{citation}} {{comment}}{{if tags}} #{{tags join=' #'}}{{endif}}</p> |
{{endif}} | {{endif}} |
</code> | </code> |
| |
* ''highlight'' | * ''highlight'' |
* ''quotes'' — if "true", add quotation marks around text; if "false" or omitted, a highlight must be placed within a blockquote to remain as an active annotation | * ''quotes'' |
| * omitted: Include quotation marks around text unless the highlight is placed within a blockquote |
| * "true": Always include quotation marks |
| * "false": Never include quotation marks. The highlight must be placed within a blockquote to remain as an active annotation. |
* ''citation'' | * ''citation'' |
* ''comment'' | * ''comment'' |
* ''color'' — yellow: '#ffd400', red: '#ff6666', green: '#5fb236', blue: '#2ea8e5', purple: '#a28ae5' | * ''color'' — yellow: '#ffd400', red: '#ff6666', green: '#5fb236', blue: '#2ea8e5', purple: '#a28ae5', magenta: '#e56eee', orange: '#f19837', gray: '#aaaaaa' |
* ''tags'' | * ''tags'' |
* ''join'' — string to use to join tags | * ''join'' — string to use to join tags |
| |
(Note that ''color'' is primarily for use in conditionals. Annotation colors can be [[pdf_reader#displaying_annotation_colors|toggled on and off]] from the note editor menu. An upcoming version will add a preference for controlling whether colors are shown by default.) | (Note that ''color'' is primarily for use in conditionals. Annotation colors can be [[pdf_reader#displaying_annotation_colors|toggled on and off]] from the note editor menu. An upcoming version will add a preference for controlling whether colors are shown by default.) |