@akebifiky/remark-simple-plantuml

中文文档
1.0.2发布于 2020/12/15MITCommonJS近 30 天下载 1.4万

remark-simple-plantuml is a simple plugin for remarkjs that converts PlantUML code written in Markdown to img tags.

原始使用文档
文档目录6 节
  1. Installing
  2. Example
  3. Markdown
  4. JavaScript
  5. Plugin Options
  6. Integration

Remark Simple PlantUML Plugin

Build Status MIT License

remark-simple-plantuml is a simple plugin for remarkjs that converts PlantUML code blocks to image nodes.

Installing

npm install --save @akebifiky/remark-simple-plantuml

Example

You can use this plugin like following

Markdown

# Your markdown including PlantUML code block

```plantuml Your title
class SimplePlantUMLPlugin {
    + transform(syntaxTree: AST): AST
}
```

JavaScript

const remark = require("remark");
const simplePlantUML = require("@akebifiky/remark-simple-plantuml");
const fs = require("fs");
const path = require("path");

const input = fs.readFileSync(path.resolve(__dirname, "./your-markdown.md")).toString();
const output = remark().use(simplePlantUML).processSync(input).toString();

console.log(output);
// will be 
// > # Your markdown including PlantUML code block
// >
// > ![Your title](https://www.plantuml.com/plantuml/png/Iyv9B2vM2CxCBSX93SX9p2i9zVK9o2bDpynJgEPI009jXPAYnBpYjFoYN8tYohoIn8gGejHKAmN7u11DCCbL2m00)

Plugin Options

You can use specific PlantUML server by the option 'baseUrl'. (The default is https://www.plantuml.com/plantuml/png)

If you want to use SVG, you can configure like following.

remark().use(simplePlantUML, { baseUrl: "https://www.plantuml.com/plantuml/svg" }).processSync(input);

Integration

You can use this plugin in any frameworks support remarkjs.

If you want to use in the classic preset of Docusaurus 2, like me, set configuration in your docusaurus.config.js like following.

const simplePlantUML = require("@akebifiky/remark-simple-plantuml");

// your configurations...

presets: [
    [
      "@docusaurus/preset-classic",
      {
        docs: {
          sidebarPath: require.resolve("./sidebars.js"),
          remarkPlugins: [simplePlantUML]
        }
      }
    ]
  ],

//...

版本与发布记录

@akebifiky/remark-simple-plantuml 共发布 3 个版本,首次发布于 2020/02/18;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.2latest2020/12/155 年前
1.0.12020/02/186 年前
1.0.02020/02/186 年前

关于 @akebifiky/remark-simple-plantuml 的常见问题

@akebifiky/remark-simple-plantuml 是什么?

remark-simple-plantuml is a simple plugin for remarkjs that converts PlantUML code written in Markdown to img tags.

如何安装 @akebifiky/remark-simple-plantuml?

在项目目录运行 npm install @akebifiky/remark-simple-plantuml,或使用 pnpm add / yarn add / bun add。

@akebifiky/remark-simple-plantuml 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/akebifiky__remark-simple-plantuml 是否存在。

@akebifiky/remark-simple-plantuml 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@akebifiky/remark-simple-plantuml 可以商用吗?

@akebifiky/remark-simple-plantuml 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@akebifiky/remark-simple-plantuml 的下载量有多少?

根据 npm 官方下载统计,@akebifiky/remark-simple-plantuml 在 2026/10/06 – 2026/11/04 这 30 天内被下载 13,517 次,日均约 451 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@akebifiky/remark-simple-plantuml 还在维护吗?

最新版本 1.0.2 发布于 2020/12/15(5 年前);至今共发布 3 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/02/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。