This repository has been archived by the owner on Jan 23, 2022. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We found it too cumbersome to write the actual example code/files inline in the documentation markdown.
We thought that being able to have the examples in external files on the filesystem, could be better due to several reasons:
The path we took is defining a new annotation, called '@external-example' which is in fact parsed by the grunt-ngdocs plugin.
The hint given to this annotation, i.e. '@external-example:my.example' will look for a directory named 'my/example/' under the base examples directory in the project (by default, a directory named 'examples' under the root dir). All of the files in this example directory will become blocks in the markdown.
Moreover, if the index.html of the example is in fact a full-blown HTML (with and other resources) - the '@external-example' would know to take only the section, since the HTML in the embedded documentation would be generated automatically later.
The base examples directory can be configured in the grunt-ngdocs plugin, the following way:
ngdocs: {
options: {
examplesDir: "my-custom-examples-dir"
}
}
I hope this is clear and useful to others.
Thanks in any case,
Daniel