This PR attempts to get a syntect implementation that actually works,
by manipulating the scope stack directly instead of trying to post-process
the HTML.
It takes strings like this:
let _t = "interesting string
\# boring string
";
And produces DOMs that look like this:
<span class="syn-source syn-rust">
<span class="syn-storage syn-type syn-rust">let</span>
_t
<span class="syn-keyword syn-operator syn-assignment syn-rust">=</span>
<span class="syn-string syn-quoted syn-double syn-rust">
<span class="syn-punctuation syn-definition syn-string syn-begin syn-rust">"</span>
interesting string
</span>
</span>
<span class="boring">
<span class="syn-source syn-rust">
<span class="syn-string syn-quoted syn-double syn-rust">boring string</span>
</span>
</span>
<span class="syn-source syn-rust">
<span class="syn-string syn-quoted syn-double syn-rust">
<span class="syn-punctuation syn-definition syn-string syn-end syn-rust">"</span>
</span>
<span class="syn-punctuation syn-terminator syn-rust">;</span>
</span>
In other words, it splits it up the same way a WYSIWYG editor might if you tried to apply a block
style to a deeply-nested selection; it maintains the styles, but always ensures "boring" is top-level.
It doesn't produce optimal HTML, but it should always work.
* Allow underscores in the link type name
* Add some tests for include anchors
* Include parts of Rust files and hide the rest
Fixes#618.
* Increase min supported Rust version to 1.35
* Add a test for a behavior of rustdoc_include I want to depend on
At first I thought this was a bug, but then I looked at some use cases
we have in TRPL and decided this was a feature that I'd like to use.
* Add search with elasticlunr.js
This commit adds search functionality to mdBook, based on work done by @phaiax. The in-browser search code uses elasticlunr.js to execute the search, using an index generated at book build time by elasticlunr-rs.
* Add generator comment
Someone on Reddit was wondering how the rust book was generated and said they checked the source. Thought I'd put this here. Might be a good idea to have a little footer "made with mdBook", but this'll do for now.
* Remove search/editor file override behavior
* Use for loop for book iterator
* Improve HTML regex
* Fix search CORS in file URIs
* Use ammonia to sanitize HTML
* Filter html5ever log messages
* Created regression tests for the table of contents
* Refactoring to make the test more readable
* Fixed some bitrot and removed the (now redundant) tests/helper module
* Removed the include_str!() stuff and use just the dummy book for testing
* Regression tests now pass again!
* Pinned a `*` dependency to use a particular version
* Made sure test mocks return errors instead of panicking
* Addressed the rest of @budziq's review
* Replaced a file open/read with file_to_string