September 03, 2017 Dub documentation with an initial ddoc file | ||||
---|---|---|---|---|
| ||||
I've been trying to figure out how to generate documentation for my project using dub. I have found this link[1] which told me how I could use dub to generate docs: dub build --build=docs <project-name> However, I wish to have a set of macros that are present on every documentation file, that would define how the resultant HTML document is rendered. I tried: dub build --build=docs <project-name> html.ddoc But I got the following error: Expected one or zero arguments. Run "dub build -h" for more information about the "build" command. How might I include `html.ddoc` with every file that has documentation? [1]: https://stackoverflow.com/questions/29762668/using-dub-to-build-documentation |
September 04, 2017 Re: Dub documentation with an initial ddoc file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Conor O'Brien | On Sunday, 3 September 2017 at 23:14:15 UTC, Conor O'Brien wrote:
> I've been trying to figure out how to generate documentation for my project using dub. I have found this link[1] which told me how I could use dub to generate docs:
>
> dub build --build=docs <project-name>
>
> However, I wish to have a set of macros that are present on every documentation file, that would define how the resultant HTML document is rendered. I tried:
>
> dub build --build=docs <project-name> html.ddoc
>
> But I got the following error:
>
> Expected one or zero arguments.
> Run "dub build -h" for more information about the "build" command.
>
> How might I include `html.ddoc` with every file that has documentation?
Add this to your dub.json:
"configurations": [
{
"name": "docs",
"buildOptions": ["syntaxOnly"],
"dflags": ["-Dddocs"],
"sourceFiles": ["html.ddoc"]
}
]
Or if you use dub.sdl:
configuration "docs" {
buildOptions "syntaxOnly"
dflags "-Dddocs"
sourceFiles "html.ddoc"
}
This adds a new configuration named "docs", which can be used like this:
$ dub -c docs
|
Copyright © 1999-2021 by the D Language Foundation