oxygenxml / dita-ot-diagrams-plugin

Dynamically convert PlantUML content inside DITA topics to SVG
Apache License 2.0
9 stars 3 forks source link

PlantUML can't be embeded in mdita like mermaid diagram can #10

Closed SmartLayer closed 1 year ago

SmartLayer commented 1 year ago

Issue #11 showed that mermaid diagram can be embedded in mdita. But the same couldn't be said for plantUML.

It's reproducible with this md file:

documents/src$ cat src/usecase/guide/testPlantUMLDiagram.md 
# Test

Short Description here

First paragraph:

<p>
    <foreign outputclass="embed-plant-uml">@startuml
    Alice -> Bob: Authentication Request
    Bob --> Alice: Authentication Response

    Alice -> Bob: Another authentication Request
    Alice &lt;-- Bob: Another authentication Response
    @enduml</foreign>
</p>

Run it through dita command (4.1) with -f pdf I got this:

documents/src$ dita -i smartlayer-overview.ditamap -f pdf -o output
[topic-reader] WARN: Unsupported HTML5 element 'foreign'
 [pipeline] WARNING: Supplied DOM declares a default namespace, but is not created as namespace-aware

image

Above file can be found at my repository's testPlantUMLDiagram.md. There is a branch for testing this.

SmartLayer commented 1 year ago

After some try-and-error, I found a workaround: remove all empty lines within the <foreign> element.

This works

$ cat testPlantUMLDiagram.md
# Test

Short Description here

First paragraph:

<p>
    <foreign outputclass="embed-plant-uml">@startuml
    Alice -> Bob: Authentication Request
    Bob --> Alice: Authentication Response
    Alice -> Bob: Another authentication Request
    Alice &lt;-- Bob: Another authentication Response
    @enduml</foreign>
</p>

Note that I still hope this issue being kept open until a md test-case is added to the samples directory, for helping newcomers to save the 2 hours I spent on investigating this.

raducoravu commented 1 year ago

@weiwu-zhang thanks for the feedback, if you want you can add a pull request to this project with extra samples. In general this project does not control how the Markdown gets converted to DITA XML content. If when publishing you set the "clean.temp" parameter to "no", after publishing you can look in the temporary files folder and see to what DITA XML topic the Markdown file was dynamically converted while publishing. This might help you debug more easily such problems in the future.

SmartLayer commented 1 year ago

merged.