When you refer to a file using plugins like markdown :include-file: my-file.cpp Znai tries to find the file in following locations:directory with the markup file that refers my-file.cpp documentation root directory locations enumerated inside <doc-root>/lookup-paths file txt ../examples ../module/src/main/java
Use --lookup-paths CLI parameter to add additional paths to lookup files. znai --lookup-paths /extra/path-one /extra/path-two
When Znai encounters zip or jar file listed inside lookup-paths it will unpack the archives into a temporary location and will use those locations to resolve files txt ../sources.zip ../module/archive.jar :include-file: dir/inside-zip-b.txt inside zip B
If files you want to include are not part of your project, you can add an HTTP base URL to lookup-paths . txt ../examples ../module/src/main/java https://raw.githubusercontent.com/testingisdocumenting/webtau/master If the file is not found using local locations, it will be fetched from the provided urls. :include-file: .travis.yml language: java jdk: - openjdk8 - openjdk11 cache: directories: - $HOME/.m2 - $HOME/.npm - node_modules dist: xenial services: - xvfb addons: chrome: stable firefox: latest apt: packages: - graphviz # disables the default install step which is mvn install skipping tests install: true script: mvn -B verify -P code-coverage
Znai is written using Java and can access resources from the classpath. Using class path lookup you can include snippets from projects deployed to, for example, Maven Central. <plugin> <groupId>org.testingisdocumenting.znai</groupId> <artifactId>znai-maven-plugin</artifactId> <version>${project.version}</version> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> <classifier>sources</classifier> </dependency> </dependencies> </plugin> :include-java: org/junit/Assert.java {entry: "fail(String)"} public static void fail(String message) { if (message == null) { throw new AssertionError(); } throw new AssertionError(message); }