@gov-cy/govcy-frontend-renderer 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +9556 -147
- package/dist/index.mjs +9556 -147
- package/package.json +3 -1
- package/src/njk/elements/markdown.njk +13 -0
- package/src/njk/govcyElement.njk +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gov-cy/govcy-frontend-renderer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Render html for design elements of the Unified design system using njk or json template.",
|
|
5
5
|
"author": "DMRID - DSF Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,6 +33,8 @@
|
|
|
33
33
|
"homepage": "https://github.com/gov-cy/govcy-frontend-renderer",
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"express": "^4.19.2",
|
|
36
|
+
"markdown-it": "^14.1.0",
|
|
37
|
+
"markdown-it-attrs": "^4.3.0",
|
|
36
38
|
"nunjucks": "^3.2.4",
|
|
37
39
|
"semver": ">=7.5.2"
|
|
38
40
|
},
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{# markdown (use with caution - no escaping)
|
|
2
|
+
@param {string} lang The language used. Can be 'en','el'. Optional.
|
|
3
|
+
@param {object} text The text. Will not escape text, Example `{en:"\n## Header 2\nThis is a **Markdown-it**",el:"## Τίτλος 2\nΑυτό είναι **Markdown-it**"}`
|
|
4
|
+
@returns html from markdown
|
|
5
|
+
#}
|
|
6
|
+
{% macro markdown(params) -%}
|
|
7
|
+
{# text is mandatory #}
|
|
8
|
+
{%- if params.text -%}
|
|
9
|
+
{#- Import localizer from utilities -#}
|
|
10
|
+
{%- from "../utilities/govcyUtilities.njk" import govcyLocalizeContent -%}
|
|
11
|
+
{{ ("" + govcyLocalizeContent(params.text, params.lang, true)) | markdown }}
|
|
12
|
+
{%- endif -%}
|
|
13
|
+
{%- endmacro %}
|
package/src/njk/govcyElement.njk
CHANGED
|
@@ -24,7 +24,7 @@ To use:
|
|
|
24
24
|
#}
|
|
25
25
|
{%- set macroSimpleBlocks = ['label', 'legend', 'hint', 'button',
|
|
26
26
|
'errorMessage','select','textElement','htmlElement','textInput','radios','checkboxes',
|
|
27
|
-
'fileInput','fileView','backLink','tag','table', 'summaryList', 'textArea'] -%}
|
|
27
|
+
'fileInput','fileView','backLink','tag','table', 'summaryList', 'textArea','markdown'] -%}
|
|
28
28
|
{%- set macroCallerBlocks = ['formControl','form','fieldset'] -%}
|
|
29
29
|
{%- macro govcyElement(component, params) -%}
|
|
30
30
|
{#- Simple blocks -#}
|