dendron
dendron copied to clipboard
Embed/include code within notes in a similar fashion to how note refs embed content from other notes in a vault
Please select if your request is either something new or an enhancement
- [ ] Enhancement of an existing Feature.
- [x] Request of a new feature.
Please select the area your request applies to. (Multiple selections are possible)
- [ ] Onboard. Initial vault setup and import/export pods
- [ ] Create. Note creation, lookup, snippets and templates
- [ ] Retrieve. Backlinks, references, graph view
- [ ] Structure. Refactoring, multi-vault and schemas
- [ ] Publish. Sharing your repo with the world
- [x] Misc (Choose this if your not sure)
Is your feature request related to a problem? Please describe
It would be great if Dendron could import/include a file with code, and display it as it would a code-block. This could work similarly to a note reference, since a note ref includes a section of a note embedded in another note.
Describe the solution you'd like
For example: I have a bash script that I'd like to version within the vault, but would also like the script to be included in a note as syntax-highlighted code. If I have a .sh bash script, for example, I'd like to include it in a note where it gets treated like:
# scripts/my-script.sh contents
echo "Hello"
Rendered and shown the same as doing code directly in a note, within a code-block. This would mean that, whatever path is taken to embed and syntax-highlight code, that there needs to be a flag/option for stating what language the syntax/language is.
This is similar to how reStructuredText literalinclude directive in Sphinx works, turning something like this source file into this rendered HTML.
I'm not sure how this would be done, but it would be similar functionality to how a note ref works with ![[note.ref.example]]. This could perhaps piggyback off of what work may go into admonitions via #1287
Describe alternatives you've considered
There could be different ways of going about this, depending on the embed/include syntax that is used within Markdown
Additional context
This is helpful if wanting to include non-markdown, non-note embeddings within documentation. This may also allow for segmentation of code if wanting to be able to test documentation.
Example scenario:
A note describes how to install and configure a CLI tool. Not only could the commands be embedded within a note, but the code itself could be tested in CI/CD. This ensures that out-dated documentation is caught immediately upon being out-dated, due to failing to run when it does (that, or it may catch bugs that weren't caught in the development process).
This sound like a great feature 🙂 probably something we want to consider this November.
Related discussion/RFC that may address this feature request: https://github.com/dendronhq/dendron/discussions/1975