@md2nativedocx/pandoc-filter 0.2.2 → 0.3.1

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.
Files changed (2) hide show
  1. package/md2nativedocx.lua +10 -3
  2. package/package.json +2 -2
package/md2nativedocx.lua CHANGED
@@ -110,10 +110,17 @@ local odf_styles = pandoc.List()
110
110
 
111
111
  local mermaid_filter = {
112
112
  CodeBlock = function(el)
113
- if el.classes[1] ~= 'mermaid' then return nil end
113
+ local lang = el.classes[1]
114
+ if lang ~= 'mermaid' and lang ~= 'plantuml' and lang ~= 'puml' then return nil end
115
+ local source = el.text
116
+ -- A ```plantuml block may leave out @startuml/@enduml (GitLab, Kroki accept that); core recognises
117
+ -- PlantUML by that header, so add it.
118
+ if lang ~= 'mermaid' and not source:match('^%s*@start') then
119
+ source = '@startuml\n' .. source .. '\n@enduml'
120
+ end
114
121
  if is_odt then
115
122
  odf_count = odf_count + 1
116
- local out, err = run_core_file(el.text, 'md2n' .. odf_count)
123
+ local out, err = run_core_file(source, 'md2n' .. odf_count)
117
124
  if not out then
118
125
  io.stderr:write(err .. '\n')
119
126
  return nil
@@ -128,7 +135,7 @@ local mermaid_filter = {
128
135
  end
129
136
  return pandoc.RawBlock('opendocument', result.fragment)
130
137
  end
131
- local xml, err = run_core_file(el.text)
138
+ local xml, err = run_core_file(source)
132
139
  if not xml then
133
140
  io.stderr:write(err .. '\n')
134
141
  return nil
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@md2nativedocx/pandoc-filter",
3
- "version": "0.2.2",
3
+ "version": "0.3.1",
4
4
  "description": "Pandoc Lua filter for md2nativedocx (Markdown to native Word): converts ```mermaid code blocks in a Markdown-to-docx conversion into editable OOXML shapes.",
5
5
  "keywords": [
6
6
  "pandoc",
@@ -34,6 +34,6 @@
34
34
  "test:ci": "node --test --test-reporter=spec --test-reporter-destination=stdout --test-reporter=junit --test-reporter-destination=reports/junit.xml test/*.test.mjs"
35
35
  },
36
36
  "dependencies": {
37
- "@md2nativedocx/core": "0.2.2"
37
+ "@md2nativedocx/core": "0.3.1"
38
38
  }
39
39
  }