RAML文档生成器raml2html详解

raml2html是一款从RAML到HTML的文档生成器,JavaScript语言编写。
raml2html默认支持Node.js,支持默认或定制theme。

1. 版本
raml2html 3.x支持RAML 0.8

raml2html 4支持RAML 1.0


2. 安装

npm i -g raml2html


安装Markdown主题
npm i -g raml2html-markdown-theme

3. 作为命令行工具使用
raml2html --help
raml2html examples\helloworld.raml > helloworld.html
raml2html --theme raml2html-markdown-theme examples\helloworld.raml > example.html
raml2html --template my-custom-template.nunjucks -i examples\helloworld.raml -o example.html


生成的页面如下:



4. 作为JS类库使用
const raml2html = require('raml2html');
const configWithDefaultTheme = raml2html.getConfigForTheme();
const configForDifferentTheme = raml2html.getConfigForTheme('raml2html-markdown-theme');
const configWithCustomTemplate = raml2html.getConfigForTemplate('~/path/to/my-custom-template.nunjucks');
raml2html.render(source, configForDifferentTheme).then(function(result) {
    // Save the result to a file or do something else with the result
    }, function(error) {
        // Output error
    });


参考链接:

https://github.com/raml2html/raml2html

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值