From 16b95967ebcd20c0c231dd66e7e6360378320b8a Mon Sep 17 00:00:00 2001 From: Miriam Suzanne Date: Wed, 14 Sep 2016 15:09:16 -0400 Subject: [PATCH] Show sample macro documentation --- templates/item/preview.macros.j2 | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/templates/item/preview.macros.j2 b/templates/item/preview.macros.j2 index d77deabc..b9b04bc0 100644 --- a/templates/item/preview.macros.j2 +++ b/templates/item/preview.macros.j2 @@ -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') %} +

+ {% if cowlick.content %} + {{ cowlick.content }} + {% else %} + No Cowlick Content + {% endif %} +

+ {% endcall %} +#} {% macro code_block(language=none, content=none) %} {% set content = content if (content != none) else caller() %} {% set language = 'jinja' if language == 'njk' else language %}