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
18.36k stars 1.65k forks source link

Include external, raw file #773

Open lukaslueg opened 6 years ago

lukaslueg commented 6 years ago

I'm sorry if this is obvious, I couldn't figure it out, though: Putting a thought into rust-lang-nursery/reference#398, one could include a SVG into the book which reacts to the book's CSS variables to stay on par with the theme chosen by the user. This however would require one to include the SVG directly into the final HTML (that is, instead of <object or <img), so that the CSS inherited from mdbook's <body> actually applies.

I can see no way to include a raw, external file into a book's final HTML, given a .md as the starting point. The provided {{#include }} seems to tinker quite a lot with file's content and it destroys the SVG's syntax.

Is there a way to pull raw, external stuff into the final HTML, with .md as the starting point and without using the API ?

tiby312 commented 3 years ago

I have a similar situation where I want to insert SVG graphs that adapt to the current theme. Would be great if there were a {{#include_raw }} to just embed files directly.

tiby312 commented 3 years ago

Actually I was able to use {{#include foo.svg}} by making sure the contents inside of the