Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mermaid Diagram Support #134

Conversation

aj-stein-nist
Copy link
Collaborator

Per the docs from the template repo we use, we need to enable this explicitly by adding the proper npm configuration and it will just work.

https://github.com/martinthomson/i-d-template/blob/c448265276fd30235326955c459fccf28f7bc364/doc/TOOLS.md?plain=1#L72-L75

Per the docs from the template repo we use, we need to enable this
explicitly by adding the proper npm configuration and it will just work.

https://github.com/martinthomson/i-d-template/blob/c448265276fd30235326955c459fccf28f7bc364/doc/TOOLS.md?plain=1#L72-L75
@aj-stein-nist
Copy link
Collaborator Author

Ugh, you need puppeteer for this? It will be enjoyable for all @OR13 (GitHub CI will be ok, others will need to configure Chrome for local draft building, I forgot this fact).

https://github.com/ietf-wg-scitt/draft-ietf-scitt-architecture/actions/runs/7062624270/job/19226846223?pr=134

If martinthomson/i-d-template#417 is reviewed and merged, this will be
included in the container image underlying the v1m variant of the
associated i-d-template@v1m template version and allow ietf-wg-scitt to
use Mermaid diagrams in the WG's drafts.
Remove test animated SVG file to see if the updated container defined
in the martinthomson/i-d-template GHA in our workflow works now.
@aj-stein-nist aj-stein-nist force-pushed the 13-support-markdown-diagrams branch from 8f0fcdc to 4d9181a Compare December 7, 2023 01:35
We were not doing this correctly, and the kramdown-rfc maintainer told
me how we can do this with IAL arguments beneath the Mermaid code block
in the referenced comment below.

cabo/kramdown-rfc#217 (comment)

Instructions from mermaid-cli are below.

https://github.com/mermaid-js/mermaid-cli/blob/f0a90b86392d0fc047db78ad169db015dc990e0d/docs/linux-sandbox-issue.md#L3
@aj-stein-nist aj-stein-nist force-pushed the 13-support-markdown-diagrams branch from 4d9181a to fcbcad0 Compare December 7, 2023 02:16
@aj-stein-nist
Copy link
Collaborator Author

I presume @OR13 stopped caring long ago, but if I figure a way to clean up the actual SVG output this might be usable and have general appeal amongst IETF WG authors, but the result has been a nice nothing burger in the end.

I got it to work, then this from svgcheck in GHA CI run:

*** [svgcheck:] ../../tmp/kramdown-rfc20231207-155-lgaec1:1: Style property 'max-width' removed
*** [svgcheck:] ../../tmp/kramdown-rfc20231207-155-lgaec1:1: Style property 'background-color' removed
*** [svgcheck:] ../../tmp/kramdown-rfc20231207-155-lgaec1:1: Style property 'text-anchor' promoted to attribute
*** [svgcheck:] ../../tmp/kramdown-rfc20231207-155-lgaec1:1: Style property 'font-size' promoted to attribute
*** [svgcheck:] ../../tmp/kramdown-rfc20231207-155-lgaec1:1: Style property 'font-weight' promoted to attribute
*** [svgcheck:] ../../tmp/kramdown-rfc20231207-155-lgaec1:1: Style property 'text-anchor' promoted to attribute
*** [svgcheck:] ../../tmp/kramdown-rfc20231207-155-lgaec1:1: Style property 'font-size' promoted to attribute
*** [svgcheck:] ../../tmp/kramdown-rfc20231207-155-lgaec1:1: Style property 'font-weight' promoted to attribute
*** [svgcheck:] ERROR: File does not conform to SVG requirements
lib/trace.sh draft-ietf-scitt-architecture.txt -s xml2rfc-txt xml2rfc -q --rfc-base-url https://www.rfc-editor.org/rfc/ --id-base-url https://datatracker.ietf.org/doc/html/ --cache=/github/workspace/.refcache --text --no-pagination draft-ietf-scitt-architecture.xml -o draft-ietf-scitt-architecture.txt
draft-ietf-scitt-architecture.xml(2016): Error: Invalid attribute font-weight for element text, at /rfc/back/section[1]/artset/artwork[1]/*/*[1]/*[2]
draft-ietf-scitt-architecture.xml(2024): Error: Invalid attribute font-weight for element text, at /rfc/back/section[1]/artset/artwork[1]/*/*[2]/*[2]/*[2]
/github/workspace/draft-ietf-scitt-architecture.xml(10): Error: Invalid document before running preptool.
Unable to complete processing draft-ietf-scitt-architecture.xml
make[1]: *** [lib/main.mk:116: draft-ietf-scitt-architecture.txt] Error 1
lib/trace.sh draft-ietf-scitt-architecture.html -s xml2rfc-html xml2rfc -q --rfc-base-url https://www.rfc-editor.org/rfc/ --id-base-url https://datatracker.ietf.org/doc/html/ --cache=/github/workspace/.refcache --html --css=lib/v3.css --metadata-js-url=/dev/null draft-ietf-scitt-architecture.xml -o draft-ietf-scitt-architecture.html
draft-ietf-scitt-architecture.xml(2016): Error: Invalid attribute font-weight for element text, at /rfc/back/section[1]/artset/artwork[1]/*/*[1]/*[2]
draft-ietf-scitt-architecture.xml(2024): Error: Invalid attribute font-weight for element text, at /rfc/back/section[1]/artset/artwork[1]/*/*[2]/*[2]/*[2]
/github/workspace/draft-ietf-scitt-architecture.xml(10): Error: Invalid document before running preptool.
Unable to complete processing draft-ietf-scitt-architecture.xml
make[1]: *** [lib/main.mk:111: draft-ietf-scitt-architecture.html] Error 1
make[1]: Target 'latest' not remade because of errors.
draft-ietf-scitt-architecture.md has no newline on the last line
*** Run 'make fix-lint' to automatically fix some errors
make[1]: *** [lib/main.mk:199: lint-whitespace] Error 1
make[1]: Target 'lint' not remade because of errors.
rm draft-ietf-scitt-architecture.xml
make: *** [lib/main.mk:16: all] Error 2

Et fin. 🤦

@OR13
Copy link
Collaborator

OR13 commented Dec 7, 2023

It turns out it's easier to learn aasvg, than it is to get mermaid to work

@aj-stein-nist
Copy link
Collaborator Author

It turns out it's easier to learn aasvg, than it is to get mermaid to work

The main challenge is we will need to "transmogrify" (to be a smart alec) the resulting SVG, but I too see the appeal. I am closing here but as a side project for when core project work is hard kind of routine I will look into this, but it is not in scope for upstream mmdc fixing or a filter script. I have been meaning to learn more about our favorite vector graphics format, and I know people into it.

But again, not in scope for convo here. More to follow and I will reach out if/when I make progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants