Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions templates/item/preview.macros.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@

{### Code Block

Generate a syntax-highlighted pre/code block.

@access public
@group code-blocks
@link https://highlightjs.org/

@author Miriam Suzanne
@since 0.1.1

@param {string} language [none] -
The language name or extension for the code contents
@param {string} content [none] -
Optionally pass in content as a string
@caller - Wrap a block of preformatted code to use
in place of the `content` string

@require {macro} scss_css - Not actually required for this macro,
but a usefull annotation to have in other cases.

@example njk - cowlick code block
{% call code_block('cowlick') %}
<p class="{{ classname }}">
{% if cowlick.content %}
{{ cowlick.content }}
{% else %}
No Cowlick Content
{% endif %}
</p>
{% endcall %}
#}
{% macro code_block(language=none, content=none) %}
{% set content = content if (content != none) else caller() %}
{% set language = 'jinja' if language == 'njk' else language %}
Expand Down