cherry-markdown icon indicating copy to clipboard operation
cherry-markdown copied to clipboard

[Feature request] Plantuml support just like mermaid

Open hanye9895 opened this issue 3 years ago • 4 comments

For most cases, mermaid should be enough, but for some people, they would like to use plantuml

** What does the proposed API look like** Just like mermaid:

import Cherry from 'cherry-markdown/dist/cherry-markdown.core';

const registerPlugin = async () => {
  const [{ default: CherryPlantumlPlugin }, plantuml] = await Promise.all([
    import('cherry-markdown/src/addons/cherry-code-block-plantuml-plugin'),
    import('plantuml'),
  ]);
  Cherry.usePlugin(CherryPlantumlPlugin, {
    plantuml, // pass in plantuml object
  });
};

registerPlugin().then(() => {
  //  Plug-in registration must be done before Cherry is instantiated
  const cherryInstance = new Cherry({
    id: 'markdown-container',
    value: '# welcome to cherry editor!',
  });
});

hanye9895 avatar Jan 05 '22 08:01 hanye9895

seems already done

hanye9895 avatar Jan 05 '22 10:01 hanye9895

But with a further look, seems it do not contain in dist folder~

hanye9895 avatar Jan 05 '22 12:01 hanye9895

@jiawei686 Do you have any ideas?

sunsonliu avatar Jan 12 '22 12:01 sunsonliu

@jiawei686 Do you have any ideas? It seems plantuml addons were not included in dist folder addon issue

And here is my usage of plantuml (just like mermaid)

const [
          { default: CherryMermaidPlugin },
          { default: mermaid },
          { default: CherryPlantumlPlugin },
          { default: plantuml }
        ] = await Promise.all([
          import('cherry-markdown/dist/addons/cherry-code-block-mermaid-plugin'),
          import('mermaid'),
          import('cherry-markdown/dist/addons/cherry-code-block-plantuml-plugin'),
          import('plantuml')
        ]);
        if (!window.hasPlugin) {
          Cherry.usePlugin(CherryMermaidPlugin, {
            mermaid 
          });
          Cherry.usePlugin(CherryPlantumlPlugin, {
            plantuml
          });
          window.hasPlugin = true;
        }

So, I try to include that in the dist folder~ Or, is there another usage of plantuml without import these addons?

hanye9895 avatar Jan 24 '22 04:01 hanye9895