akebifiky / remark-simple-plantuml

A simple plugin for remarkjs that converts PlantUML code written in Markdown to img tags.
MIT License
26 stars 7 forks source link

Specify baseURL for Docusaurus 2 Plugin #4

Closed Ekion-1 closed 3 years ago

Ekion-1 commented 3 years ago

I've tried to specify a baseURL when defining the plugin but it doesn't seem to be making a difference. Am I approaching this the right way?

presets: [
    [
      '@docusaurus/preset-classic',
      {
        docs: {

          sidebarPath: require.resolve('./sidebars.js'),
          remarkPlugins: [simplePlantUML( { baseUrl: "<CustomURL>" })]
        },
        blog: {
          showReadingTime: true,
        },
        theme: {
          customCss: require.resolve('./src/css/custom.css'),
        },
      },
    ],
  ],
akebifiky commented 3 years ago

You can specify your custom options like following 👍

presets: [
    [
      '@docusaurus/preset-classic',
      {
        docs: {

          sidebarPath: require.resolve('./sidebars.js'),
          remarkPlugins: [[simplePlantUML, { baseUrl: "CUSTOM_URL" }]]
        },
        blog: {
          showReadingTime: true,
        },
        theme: {
          customCss: require.resolve('./src/css/custom.css'),
        },
      },
    ],
  ],

In docusaurus, remark plugins with options can be specified as array! More helps: https://v2.docusaurus.io/docs/markdown-features/#configuring-plugin-options

Ekion-1 commented 3 years ago

Thanks for the heads up. I've just tried it but all image requests are still coming from plantuml.com. Any other suggestions?

image

akebifiky commented 3 years ago

Oh, I got same issue😭 It seems that there is something cached by Docusaurus, so can you try clearing cache with following command?

npx docusaurus clear

And then, reboot with docusaurus start (or your start script)

Ekion-1 commented 3 years ago

Fantastic, that did it. Thanks!