asciidoc转换html,swagger生成html文档

swagger生成html、pdf文档

依赖

io.springfox

springfox-swagger2

2.9.2

io.swagger

swagger-annotations

io.swagger

swagger-models

io.swagger

swagger-annotations

1.5.21

io.swagger

swagger-models

1.5.21

io.springfox

springfox-swagger-ui

2.9.2

io.github.swagger2markup

swagger2markup

1.3.3

springbootTest类

@RunWith(SpringRunner.class)

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)

public class DemoApplicationTests {

@Test

public void generateAsciiDocs() throws Exception {

// 输出Ascii格式

Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()

.withMarkupLanguage(MarkupLanguage.ASCIIDOC)

.build();

Swagger2MarkupConverter.from(new URL("http://localhost:8080/v2/api-docs"))

.withConfig(config)

.build()

.toFolder(Paths.get("src/docs/asciidoc/generated"));

}

}

执行测试类后就生成出了4个不同的静态文件。

src

--docs

----asciidoc

------generated

--------definitions.adoc

--------overview.adoc

--------paths.adoc

--------security.adoc

通过插件生成静态文件

除了通过上面编写Java代码来生成的方式之外,swagger2markup还提供了对应的Maven插件来使用

io.github.swagger2markup

swagger2markup-maven-plugin

1.3.1

http://localhost:8080/v2/api-docs

src/docs/asciidoc/generated

ASCIIDOC

通过插件生成html

org.asciidoctor

asciidoctor-maven-plugin

1.5.6

src/docs/asciidoc/generated

src/docs/asciidoc/html

html

coderay

left

执行该插件的asciidoctor:process-asciidoc命令之后,就能在src/docs/asciidoc/html目录下生成最终可用的静态部署HTML了。

html和pdf

org.asciidoctor

asciidoctor-maven-plugin

1.5.3

org.asciidoctor

asciidoctorj-pdf

1.5.0-alpha.10.1

org.jruby

jruby-complete

1.7.21

src/docs/asciidoc/generated

coderay

left

output-html

generate-resources

process-asciidoc

html5

src/docs/asciidoc/html

output-pdf

generate-resources

process-asciidoc

pdf

src/docs/asciidoc/pdf

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值