upgrade readme

This commit is contained in:
oppofind 2020-10-19 23:46:40 +08:00
parent 79b7351ab3
commit f132e6811f
2 changed files with 15 additions and 15 deletions

View File

@ -20,10 +20,10 @@ smart-doc does not need to inject annotations into the code like Swagger.
- Support for automatic generation of request examples based on request parameters.
- Support for generating JSON return value examples.
- Support for loading source code from outside the project to generate field comments (including the sources jar package).
- Support for generating multiple formats of documents: Markdown, HTML5, Asciidoctor,Postman Collection json,OpenAPI 3.0.
- Support for generating multiple formats of documents: Markdown,HTML5,Asciidoctor,Postman Collection,OpenAPI 3.0.
- Support for exporting error codes and data dictionary codes to API documentation.
- Support Apache Dubbo RPC.
## Getting started
## Getting Started
[Smart-doc Samples](https://github.com/shalousun/smart-doc-demo.git)。
```
# git clone https://github.com/shalousun/smart-doc-demo.git
@ -31,7 +31,7 @@ smart-doc does not need to inject annotations into the code like Swagger.
This example already provides a static html document generated in advance. You can start the Spring Boot project and then go directly to `http://localhost:8080/doc/api.html` to view the interface documentation generated by smart-doc.
Of course, you can also browse `http://localhost:8080/doc/api.html`,
which looks a html like generated by `asciidoctor-maven-plugin` plugin.
### Add Maven plugin
### Add Maven Plugin
Add [smart-doc-maven-plugin](https://github.com/smart-doc-group/smart-doc-maven-plugin) in your pom.xml.
```
<plugin>
@ -64,7 +64,7 @@ Add [smart-doc-maven-plugin](https://github.com/smart-doc-group/smart-doc-maven-
</executions>
</plugin>
```
### Create a json config
### Configuration
Create a JSON configuration file in your project. The smart-doc-maven-plugin plugin will use this configuration information.
For example, create `/src/main/resources/smart-doc.json` in the project.
The configuration contents are as follows.
@ -165,7 +165,7 @@ When you need to use smart-doc to generate more API document information, you ca
**Note:** This JSON configuration can be converted into JSON using smart-doc's ApiConfig Object.
So the project configuration can also refer to the introduction of smart-doc.
### Generated document
#### Run plugin with maven command
#### Run Plugin with MAVEN command
```
// Generate html
mvn -Dfile.encoding=UTF-8 smart-doc: html
@ -197,12 +197,12 @@ Java home: D:\ProgramFiles\Java\jdk1.8.0_191\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"
```
#### Run plugin in IDEA
#### Run Plugin in IDEA
On Use IntelliJ IDE, if you have added smart-doc-maven-plugin to the project,
you can directly find the plugin smart-doc plugin and click to generate API documentation.
![smart-doc-maven-plugin](https://raw.githubusercontent.com/shalousun/smart-doc-maven-plugin/master/images/idea.png)
### Use gradle plugin
### Use Gradle Plugin
If you use gradle to build the project, you can refer to the documentation of the gradle plugin to integrate,
[smart-doc-gradle-plugin](https://github.com/smart-doc-group/smart-doc-gradle-plugin/blob/master/README.md)
### Generated document example

View File

@ -27,17 +27,17 @@ $\color{red}{我因不将就而诞生,用了无数个日日夜夜来成长,
- 支持导出错误码和定义在代码中的各种字典码到接口文档。
- 支持Maven、Gradle插件式轻松集成。
- 支持Apache Dubbo RPC接口文档生成。
## Getting started
## Getting Started
smart-doc使用和测试可参考[smart-doc demo](https://gitee.com/sunyurepository/api-doc-test.git)。
```
# git clone https://gitee.com/sunyurepository/api-doc-test.git
```
你可以启动这个Spring Boot的项目然后访问`http://localhost:8080/doc/api.html`来浏览smart-doc生成的接口文档。
### Add Maven plugin
smart-doc官方目前已经开发完成[maven插件](https://gitee.com/smart-doc-team/smart-doc-maven-plugin)
和[gradle插件](https://gitee.com/smart-doc-team/smart-doc-gradle-plugin)
### Add Maven Plugin
smart-doc官方目前已经开发完成[Maven插件](https://gitee.com/smart-doc-team/smart-doc-maven-plugin)
和[Gradle插件](https://gitee.com/smart-doc-team/smart-doc-gradle-plugin)
你可以根据自己的构建工具来选择使用Maven插件或者是Gradle插件。
#### add plugin
#### Add Plugin
```
<plugin>
<groupId>com.github.shalousun</groupId>
@ -71,7 +71,7 @@ smart-doc官方目前已经开发完成[maven插件](https://gitee.com/smart-doc
</executions>
</plugin>
```
#### Add Config
#### Configuration
在项目中添加创建一个`smart-doc.json`配置文件,插件读取这个配置来生成项目的文档,
这个配置内容实际上就是以前采用单元测试编写的`ApiConfig`转成json后的结果因此关于配置项说明可以参考原来单元测试的配置。
@ -194,7 +194,7 @@ mvn -Dfile.encoding=UTF-8 smart-doc:rpc-markdown
mvn -Dfile.encoding=UTF-8 smart-doc:rpc-adoc
```
**注意:** 尤其在window系统下如果实际使用Maven命令行执行文档生成可能会出现乱码因此需要在执行时指定`-Dfile.encoding=UTF-8`。
#### Use Idea
#### Use in IDEA
![idea中smart-doc-maven插件使用](https://gitee.com/smart-doc-team/smart-doc-maven-plugin/raw/master/images/idea.png "maven_plugin_tasks.png")
### Use gradle plugin
@ -227,7 +227,7 @@ mvn clean install -Dmaven.test.skip=true
- [smart-doc功能使用介绍](https://my.oschina.net/u/1760791/blog/2250962)
- [smart-doc官方wiki](https://gitee.com/smart-doc-team/smart-doc/wikis/Home?sort_id=1652800)
## License
Smart-doc is under the Apache 2.0 license. See the [LICENSE](https://gitee.com/smart-doc-team/smart-doc/blob/master/LICENSE) file for details.
smart-doc is under the Apache 2.0 license. See the [LICENSE](https://gitee.com/smart-doc-team/smart-doc/blob/master/LICENSE) file for details.
**注意:** smart-doc源代码文件全部带有版权注释使用关键代码二次开源请保留原始版权否则后果自负
## Who is using