johanneswuerbach / backstage-plugin-techdocs-addon-mermaid

Backstage TechDocs Mermaid Addon
MIT License
43 stars 18 forks source link

fix: support mermaid diagrams with frontmatter directives #52

Closed johanhammar closed 1 week ago

johanhammar commented 1 week ago

Support diagrams containing frontmatter directive. Might fix https://github.com/johanneswuerbach/backstage-plugin-techdocs-addon-mermaid/issues/48

Possibly a bit naive solution that seems to work, perhaps even the codeSplitByDirectiveStart block can be removed to with this fix?

johanhammar commented 1 week ago

This fixes https://github.com/johanneswuerbach/backstage-plugin-techdocs-addon-mermaid/issues/46 as well. Do you want me to add a test for this as well?

it("mermaid code exists with comment", () => {
      const mermaidCode = `%% mermaid code with comment
graph LR
A-->B`;

      const result = isMermaidCode(mermaidCode);

      expect(result).toBe(true);
    });
johanneswuerbach commented 1 week ago

Do you want me to add a test for this as well?

I think it can't hurt as those quickly running unit tests. Thank you 🙇

johanhammar commented 1 week ago

Anything else I can do to get this merged? 🤔

johanneswuerbach commented 1 week ago

Thanks for the bump and contribution ❤️ , released as backstage-plugin-techdocs-addon-mermaid@0.12.1.