Currently, tangle can only extract code blocks from a source (Markdown) file. For some use cases it would be beneficial to provide the opposite operation, i.e. replacing the body of a code block with the contents of a give file:
# Example markdown source file
```ts tangle:export/foo.ts
// some code to be extracted
// ...
```
```ts transclude:export/bar.ts
// content of this block will be replaced w/ file contents
```
A concrete use case for this is the @thi.ng/wasm-api-bindgen readme, where the example JSON type specifications for the code generator are (already) tangled from the readme, however, at current, the generated source code must be manually copied back into the readme. Having transclusion support would allow this to be automated. Same goes for the various examples in the book/courseware docs...
Related:
Add CLI option to edit source file in-place (e.g. -i)
Add CLI option to write updated file to another file path (e.g. -o PATH), if missing output to stdout
Currently,
tangle
can only extract code blocks from a source (Markdown) file. For some use cases it would be beneficial to provide the opposite operation, i.e. replacing the body of a code block with the contents of a give file:A concrete use case for this is the @thi.ng/wasm-api-bindgen readme, where the example JSON type specifications for the code generator are (already) tangled from the readme, however, at current, the generated source code must be manually copied back into the readme. Having transclusion support would allow this to be automated. Same goes for the various examples in the book/courseware docs...
Related:
-i
)-o PATH
), if missing output to stdout