jelly-beam / rebar3_ex_doc

rebar3 plugin for generating docs with ex_doc
Apache License 2.0
43 stars 13 forks source link

`with_mermaid` embedded after `before_closing_body_tag` #63

Closed MarkoMin closed 7 months ago

MarkoMin commented 1 year ago

I have I use case where I want to use mermaid to render diagrams in docs, but I want to manipulate <svg> elements afterwards with custom javascript. When I embed mermaid script manually in before_closing_body_tag it works, but when I use with_mermaid option, graphs are renedered, but not customized via JS. Can mermaid script be executed b4 before_closing_body_tag?

I didn't dig into source, but I could come with PR if the solution is wanted.

starbelly commented 1 year ago

This was fixed up in #59 if I understand your problem correctly. Are you using the latest version of rebar3_ex_doc (v0.2.20)?

MarkoMin commented 1 year ago

No, that issue just made the solution complete. However, imagine if you want to set all diagrams to be full-screen on click. Then, you firstly need to render them (embedded script via with_mermaid) and than you execute for loop over <svg> elements in before_closing_body_tag. However, ATM before_closing_body_tag gets executed b4 mermaid scripts so it has no effect because diagrams are not rendered yet.

starbelly commented 1 year ago

@MarkoMin I see. A PR is quite welcome.