rust-lang / mdBook

Create book from markdown files. Like Gitbook but implemented in Rust
https://rust-lang.github.io/mdBook/
Mozilla Public License 2.0
17.84k stars 1.62k forks source link

Advanced features when including files #2366

Open jcelerier opened 5 months ago

jcelerier commented 5 months ago

Problem

Hello, I have some documentation with mdbook which heavily reference material under the form of source files, which I include for instance like this :

```
{{ #include some/file }}
```

Now I would like to globally control how this pattern is rendered, for instance automatically display a link to the source file in the git repository for easy access. What would be the best way to do this ? Most likely this cannot be done in the theme as by then the content has already been copied.

Proposed Solution

What would solve my immediate problem: an option in [output.html] such as display-include-file-links = true which would render a small bar above each code block with a link to the included file. The host could be provided in another option, e.g. for instance to point to source files hosted on github in the source repository.

Notes

No response