如何使用znai将现有示例嵌入我的降价文档中

发布于 2025-02-09 17:45:18 字数 70 浏览 1 评论 0 原文

我记录了我的API的用法,并想参考GitHub存储库中的其他人。

如何使用ZNAi将文件的内容包括在我的文档中?

I document usage of my API and want to refer to other people examples from GitHub repositories.

How do I include content of a file from GitHub into my documentation using Znai?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萌吟 2025-02-16 17:45:18

znai 您可以在 lookup-paths 文件中指定查找位置。受支持的位置之一是http位置,例如在此示例中: https:/https:/ /testingisdocumenting.org/znai/flow/lookup-paths#http-lookup-location

例如,

https://raw.githubusercontent.com/testingisdocumenting/webtau/master

lookup-paths lookup paths lookup paths 已设置,使用 include include-file plugin 插件和嵌入式文件内容从仓库

:include-file: webtau-data/src/main/java/org/testingisdocumenting/webtau/data/Data.java

或使用其他插件,例如包括groovy 提取特定方法的身体

:include-groovy: webtau-data/src/test/groovy/org/testingisdocumenting/webtau/data/DataCsvTest.groovy {
  entry: "validateTestCsvTable"
}
table.should == ['id' | 'absolute' | 'number' | 'comment'] {
                _______________________________________________
                'id1' | 'yes'      | '12'     | 'what can you say'
                'id2' | 'no'       | '24'     | 'fourth' }

In Znai you can specify lookup locations inside lookup-paths file. One of the supported locations is HTTP location like in this example: https://testingisdocumenting.org/znai/flow/lookup-paths#http-lookup-location

For example, to include a content from a repo I have following entry in my lookup-paths file

https://raw.githubusercontent.com/testingisdocumenting/webtau/master

Once lookup-paths is set, use include-file plugin and embedded a file content from the repo

:include-file: webtau-data/src/main/java/org/testingisdocumenting/webtau/data/Data.java

Or use other plugins like include-groovy to extract a specific method body

:include-groovy: webtau-data/src/test/groovy/org/testingisdocumenting/webtau/data/DataCsvTest.groovy {
  entry: "validateTestCsvTable"
}
table.should == ['id' | 'absolute' | 'number' | 'comment'] {
                _______________________________________________
                'id1' | 'yes'      | '12'     | 'what can you say'
                'id2' | 'no'       | '24'     | 'fourth' }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文