This plugin for typedoc copies the assets found in comments to the output assets folder.
This way if you define any assets in the jsdoc comment it will be copied into the output folder and the path modified to be used from there.
The path must be relative (starting with ./
or ../
) to the current file processed to be copied to the output.
Same named files (from different paths) will be suffixed with an index.
To configure what assets are copied you can configure it in the typedoc options file. By default only images (e.g. ![label](./path/image.png)
) are copied to allow non image links (e.g. [label](./path/image.md)
), set the only images to false.
To define more granular control over what is copied add regexes to the include
/includePath
lists and/or exclude
/excludePath
lists.
You can enable the copy from html image tags (e.g. <img src="https://github.com/droppedcode/typedoc-plugin-copy-assets/raw/main/path/to/image.png" alt="Image" />
) with the copyHtmlImgTag
option. It handles all paths as relative (e.g. path/img.png
is same as ./path/img.png
).
E.g. configuration that allows png images and md files, but not from the exclude folder:
{
"copyAssets": {
"onlyImages": false,
"include": [],
"exclude": [],
"includePath": [".(png|md)$"],
"excludePath": [".*?exclude/.*?$"],
"copyHtmlImgTag": false
}
}
onlyImages
changes that markdown links [foo](bar)
or only images ![foo](bar)
are matched.copyHtmlImgTag
option adds html img link matches.There are 2 pairs, the include
/exclude
will match against the whole link (e.g. [foo](bar.baz)
), the includePath
/excludePath
will be matched against the path part only (e.g. bar.baz
).
The workflow:
include
list, removing non matching links.exclude
list, removing matching links.includePath
list, removing non matching paths.excludePath
list, removing matching paths.The output will be determined from the settings of typedoc using the out
option (see typedoc options) joined with assets/media
.
Supports 0.25 (tested with 0.25.2)
For 0.23 see version 1.0.9
For 0.22 see version 1.0.4
npm run test:prep
@droppedcode/typedoc-plugin-copy-assets
version in tests\typedoc-plugins-example\package.json
if needednpx typedoc
in the tests\typedoc-plugins-example
foldercopyHtmlImgTag
option, default false.includePath
/ excludePath
options.