Commit Graph

156 Commits

Author SHA1 Message Date
Eric Huss 2f59943c04 rustfmt with 1.40
Some slight changes in formatting in 1.40.
2019-12-31 16:23:25 -08:00
Dylan DPC 1f505c2b2e
Revert "Add support for Rust edition 2018 in playpens (#1086)" (#1093)
This reverts commit a7b3aa0444.
2019-11-11 13:24:13 +01:00
Gabriel Majeri a7b3aa0444 Add support for Rust edition 2018 in playpens (#1086)
* Add support for Rust edition 2018 in playpens

* Add Rust edition support to rustdoc

* Run rustfmt

* Fix enum variant reference
2019-11-11 12:42:24 +01:00
Eric Huss 21d8f394ae Fix "next chapter" spacer handling. (#1075) 2019-10-25 17:33:21 +02:00
Weihang Lo 6af6219e5b [Feature] expandable sidebar sections (ToC collapse) (#1027)
* render(toc): render expandable toc toggle

* ui(toc): js/css logic to toggle toc

* test: update rendered output css selector

* config: add `html.fold.[enable|level]`

* renderer: fold according to configs

* doc: add `output.html.fold`

* refactor: tidy fold config

- Derive default for `Fold`.
- Use `is_empty` instead of checking the length of chapters.
2019-10-19 09:56:08 +02:00
Benedikt Werner 84a2ab0dba Reapply: Move hiding of boring lines into static content (#846) (#1065)
* Move hiding of boring lines into static content (#846)

* Fix test for hidden code
2019-10-16 11:27:14 +02:00
Carol (Nichols || Goulding) ac1749ff2f Implement a `rustdoc_include` preprocessor (#1003)
* 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.
2019-10-06 00:27:03 +02:00
Carol (Nichols || Goulding) f9f9785839
When this test fails, print out why to assist in debugging 2019-08-12 09:50:54 -04:00
Eric Huss 6199e4df79 Bump elasticlunr. 2019-07-12 09:53:11 -07:00
Eric Huss 228e99ba11 Fix even more print page links. (#963) 2019-07-01 17:52:25 +02:00
Carol (Nichols || Goulding) b83c55f7ef
Switch to the standard library's fs::read_to_string 2019-06-19 22:49:18 -04:00
Eric Huss 07830f7f11
Merge pull request #891 from integer32llc/include-before-test
Write preprocessed content to file before testing with rustdoc
2019-06-12 15:01:58 -07:00
Eric Huss 2497e77bf1 Support strikethrough and tasklists. (#952) 2019-06-12 17:02:03 +02:00
rnitta a655d5d241 Header elements wrap links (#948)
* swap hierarchy of header for that of link

* fix comment
2019-06-03 14:31:15 +02:00
lzutao 53ba0d6655 Remove 'static lifetime from static vars (#947) 2019-05-31 18:01:02 +02:00
Lzu Tao 672cf456eb Remove unnecessary ::<crate>
Find and replace with `git grep -E '\W::[a-z]'` command.
2019-05-30 23:12:33 +07:00
lzutao 8542f7f29d Transition to 2018 edition (#933)
* Transition to 2018 edition

* Update Travis CI badge in README

* Remove non-idiomatic `extern crate` lines
2019-05-25 20:50:41 +02:00
Bas Bossink e3ec751a3f Issue 703 (#929)
* Replace all occurances of altenate backend with alternative backed

Rename test for consistency of the terminology.

* Use better sed command
2019-05-19 22:16:10 +02:00
Allen df12cc55c8 Revert "Merge pull request #889 from s3bk/master" (#917)
* Revert "Merge pull request #889 from s3bk/master"

This reverts commit b30b58b565, reversing
changes made to c6220fba83.

* format tests :P
2019-05-09 20:18:28 +02:00
Eric Huss cb4a3e0711 Fix more print.html links. (#871) 2019-05-08 23:50:59 +02:00
Bas Bossink 506996808b Fix issue 832 (#841)
* Add if around stub summary creation

Check if an existing SUMMARY.md is present to prevent overwriting it
with the stub SUMMARY.md.

[#832]

* Add test for existing SUMMARY.md
2019-05-08 21:13:20 +02:00
Philipp Hansch 5163c5ab75 Don't let robots index the print.html (#844) 2019-05-08 00:32:43 +02:00
Eric Huss 8bb5426441 Fix keyboard chapter navigation for `file` urls. (#915) 2019-05-08 00:29:46 +02:00
lzutao ab7802a9a9 Fix most of clippy warnings (#914)
* Fix clippy: cast_lossless

* Fix clippy: match_ref_pats

* Fix clippy: extra_unused_lifetimes

* Fix clippy: needless_lifetimes

* Fix clippy: new_without_default

* Fix clippy: or_fun_call

* Fix clippy: should_implement_trait

* Fix clippy: redundant_closure

* Fix clippy: const_static_lifetime

* Fix clippy: redundant_pattern_matching

* Fix clippy: unused_io_amount

* Fix clippy: string_lit_as_bytes

* Fix clippy: needless_update

* Fix clippy: blacklisted_name

* Fix clippy: collapsible_if

* Fix clippy: match_wild_err_arm

* Fix clippy: single_match

* Fix clippy: useless_vec

* Fix clippy: single_char_pattern

* Fix clippy: float_cmp

* Fix clippy: approx_constant
2019-05-06 20:20:58 +02:00
Lzu Tao 0aa3a9045a cargo fmt 2019-05-05 22:00:24 +07:00
Dylan DPC 652eab6e7e
Update custom_preprocessors.rs 2019-05-03 20:32:56 +02:00
Dylan DPC 5726a8afd6
Update build_process.rs 2019-05-03 20:00:43 +02:00
Carol (Nichols || Goulding) 4abac12c04
Fix deprecation warnings for trim left/right matches 2019-03-23 08:47:10 -04:00
Carol (Nichols || Goulding) d7c7d91005
Write preprocessed content to file before testing with rustdoc
Fixes #855.
2019-03-23 08:35:44 -04:00
Steve Klabnik a481735fa2 failing test 2019-01-15 14:08:53 -05:00
Bas Bossink 3598e905aa Make failing_alternate_backend test more platform specific
Use the suggestion from @Michael-F-Bryan to make the passing_ and
failing_alternate_backend test more reliable across platforms.
2018-12-05 22:26:53 +01:00
Bas Bossink 742dbbc917 Run rustfmt. 2018-12-04 00:11:41 +01:00
Michael Bryan 132f4fd358
Fixed a bug where the tests use the wrong dummy book 2018-09-16 23:33:58 +08:00
Michael Bryan 1d72cea972
The example preprocessor works 2018-09-16 23:28:01 +08:00
Michael Bryan 1aa1194d79
We can shell out to the preprocessor 2018-09-16 23:23:03 +08:00
Michael Bryan 304234c122
The example can now tell mdbook if renderers are supported 2018-09-16 23:00:19 +08:00
Michael Bryan 729c94a7e4
Started working on a custom preprocessor 2018-09-16 22:49:52 +08:00
Michael Bryan 09667c9956
Configurable preprocessor (#658)
* The preprocessor trait now returns a modified book instead of editing in place

* A preprocessor is told which render it's running for

* Made sure preprocessors get their renderer's name

* Users can now manually specify whether a preprocessor should run for a renderer

* You can normally use default preprocessors by default

* Got my logic around the wrong way

* Fixed the `build.use-default-preprocessors` flag
2018-09-10 18:55:58 +08:00
Matt Ickstadt 1d69ccae48 Run rustfmt
using 0.8.2-stable included in rustc 1.28.0
2018-08-02 20:22:49 -05:00
Matt Ickstadt 1d1d4d7c30 Update tests to handle added dummy_book chapter 2018-07-25 12:45:20 -05:00
Matt Ickstadt 0e1787c617 Don't run index preprocessor on `mdbook test` 2018-07-25 12:19:01 -05:00
Matt Ickstadt e5563182fc Add readme to cause test to fail
The test for `mdbook test` fails due to the index preprocessor which only runs on README files.
2018-07-25 12:14:27 -05:00
Matt Ickstadt 5835da2432 Run rustfmt 2018-07-23 12:47:04 -05:00
Matt Ickstadt e94078cc9c Fix tests 2018-07-23 12:08:04 -05:00
cetra3 bdb37ec117 Use relative links and translate internal references (#603)
* Relative links for 0.1.8

* Compat for IE11 search
2018-07-11 21:33:44 +08:00
Andrew Gauger 2a55ff62f3 Recursively apply preprocessor (#682) 2018-05-20 18:36:19 +08:00
Matt Ickstadt 9a9c625319 Fix default theme dir selection 2018-05-14 14:52:29 -05:00
Weihang Lo 69599646e7 Add index preprocessor (#685)
* Add index preprocessor

README.md is a de facto index file in markdown-based documentation.
Hence, we respect to README.md and convert it into index.html.

* Fix warning for unused variables

* Update tests for config

* Match file stem case-insensitively for IndexPreprocessor

* Add tests for IndexPreprocessor

* Update book example to fit index preprocessor
2018-05-04 19:41:28 +08:00
Bastien Orivel 55f7ed1c37 Replace tempdir by tempfile (#650)
The former has been deprecated in favor of the latter
2018-03-27 07:47:37 +08:00
Matt Ickstadt 5fb3675151 Update elasticlunr-rs (#646)
* Update dependencies

* Use config structs from elasticlunr-rs

* Update searchindex fixture
2018-03-20 20:22:35 +08:00
Matt Ickstadt b2ad669c61 Search with Elasticlunr, updated (#604)
* 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
2018-03-07 21:02:06 +08:00
Michael Bryan bda23f0183
Missing backends are no longer fatal 2018-01-25 01:15:29 +08:00
Michael Bryan c89245b45b
Recursively apply replace_all() when running the links preprocessor (#564)
* Looks like we forgot to recursively apply replace_all() in #532

* Removed some print statements

* Made sure we ignore the rendered dummy_book
2018-01-22 06:44:28 +08:00
Michael Bryan 232a923676
Added a windows-specific `tee` equivalent (#561)
* Added a windows-specific `tee` equivalent

* Changed how the windows "tee" command gets quoted

* Temporarily disabled the backends_receive_render_context_via_stdin test
2018-01-20 21:46:44 +08:00
Jaime Valdemoros 80a20eb730 Use Arc instead of lazy_static for dummy preprocessor 2018-01-17 19:02:25 +00:00
Jaime Valdemoros 4177288b11 Add test to make sure pre-processors are being run 2018-01-16 22:39:11 +00:00
Michael Bryan 9ab54412ea
Made it so the CmdRenderer writes directly to the child's stdin (#544) 2018-01-14 19:14:27 +08:00
vabc3 fd8f3bb415 Remove unneeded mut modifier in test (#534) 2018-01-08 00:25:45 +08:00
Michael Bryan fd7e8d1b7b
Add support for alternative backends (#507)
* Added a mechanism for creating alternate backends

* Added a CmdRenderer and the ability to have multiple renderers

* Made MDBook::load() autodetect renderers

* Added a couple methods to RenderContext

* Converted RenderContext.version to a String

* Made sure all alternate renderers are invoked as `mdbook-*`

* Factored out the logic for determining which renderer to use

* Added tests for renderer detection

* Made it so `mdbook test` works on the book-example again

* Updated the "For Developers" docs

* Removed `[output.epub]` from the example book's book.toml

* Added a bit more info on how backends should work

* Added a `destination` key to the RenderContext

* Altered how we wait for an alternate backend to finish

* Refactored the Renderer trait to not use MDBook and moved livereload to the template

* Moved info for developers out of the book.toml format chapter

* MOAR docs

* MDBook::build() no longer takes &mut self

* Replaced a bunch of println!()'s with proper log macros

* Cleaned up the build() method and backend discovery

* Added a couple notes and doc-comments

* Found a race condition when backends exit really quickly

* Added support for backends with arguments

* Fixed a funny doc-comment
2018-01-07 22:10:48 +08:00
Jan Likar dedc208a6a Prohibit 'print.md' files (#524)
* Prohibit 'print.md' files

Fix #258 by emmiting an error whenever an mdBook contains a
"print.md" file in its root.

* Apply suggested changes

* Add tests
2018-01-07 00:02:23 +08:00
Michael Bryan cba16a0083
Updated dependencies and made logging more readable 2017-12-30 18:43:46 +08:00
Michael Bryan 148511eceb
Able to parse all existing SUMMARY.md files 2017-12-11 17:20:05 +11:00
Michael Bryan f5e9b857de
Rewrote summary parser from a state machine to use recursive descent 2017-12-11 15:17:20 +11:00
Michael Bryan 4f4e86db3a
Added tests to make sure we parse existing SUMMARY.md's 2017-12-11 12:26:11 +11:00
Michael Bryan ace0b51fb6
Put the `create_missing` feature back in 2017-12-11 10:32:35 +11:00
Michael Bryan 9950f69c48
Removed the `MDBook::read_config()` method because it's redundant now 2017-12-10 23:13:46 +11:00
Michael Bryan 12d1ed5558
The example book renders correctly 2017-12-10 22:59:35 +11:00
Michael Bryan 751da4f05f
Added a test to make sure you can include rust files in chapters 2017-12-10 22:59:35 +11:00
Michael Bryan f993677626
All tests finally pass! 2017-12-10 22:52:00 +11:00
Michael Bryan 21498631b3
Made sure the dummy book can build 2017-12-10 22:50:57 +11:00
Michael Bryan 8b21da9950
Fleshed out book creation 2017-12-10 22:50:57 +11:00
Michael Bryan 47eb4788cb
Introduced the `BookBuilder`.
- You now use a `BookBuilder` for creating a book directory tree

- This also removes the `--no-create` argument
2017-12-10 22:49:40 +11:00
Michael Bryan 42ff5a895c
Added a test to make sure book.toml isn't required 2017-12-09 20:46:39 +11:00
Chris Spiegel 803df90efa Add tests to check create-missing. 2017-12-02 22:53:19 -08:00
Chris Spiegel b0b09bad3f Clean up build configuration.
This rolls all "create missing" handling into BuildConfig, and moves the
build-dir option from the "book" table to the "build" table. Some
documentation cleanup surrounding the build table is also updated.
2017-11-30 07:39:58 -08:00
Michael Bryan d56ff94ce6
Regression tests (#422)
* 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
2017-11-16 15:51:12 +08:00
Michael Bryan 3aa6436679
Added in things from @Phaiax's review 2017-11-12 21:37:38 +08:00
Michael Bryan d37821c194
Rebased after #438 2017-11-12 21:37:38 +08:00
Michael Bryan 18c725ee12
Integration tests pass again 2017-11-12 21:37:37 +08:00
Michael Bryan cee3296a32
main library tests pass 2017-11-12 21:37:37 +08:00
Pratik Karki 382fc4139b run rustfmt on the repository #398(Updated) (#438)
rustfmt the repository #398
2017-10-03 13:40:23 +02:00
Behnam Esfahbod 956a5cc7fd Fix heading links in nested pages
Plus fixing the whitespace chars not being replaced by hyphen.

Also expand tests for link creations, and add test for nested pages.

Fixes <https://github.com/azerupi/mdBook/issues/416>
Fixes <https://github.com/azerupi/mdBook/issues/417>
2017-09-06 00:52:17 -07:00
Behnam Esfahbod cef62ec42e Fix build and test warnings
Move non-test test module files into their own directories to prevent
cargo from running them as tests. Then suppress the left-over warnings.

Move *dummy book* code and data into a shared folder, and leave the rest
of helper utilities (one function) in the original module.
2017-09-06 00:52:17 -07:00
projektir 16aa545c5b Integrating Ace #247 2017-08-03 22:45:33 -04:00
Michael Bryan e2eb40bded Got some feedback from azerupi and added a DummyBook builder 2017-08-02 22:29:28 +08:00
Michael Bryan 0c3a2b80f8 Tested MDBook::init with custom args 2017-07-10 18:23:51 +08:00
Michael Bryan 29e00c0d97 Broke the integration tests out into individual sections 2017-07-10 18:17:19 +08:00
Michael Bryan 7e8819f4d2 Bye bye println() debugging 2017-07-09 22:08:57 +08:00
Michael Bryan c90c0f7848 Updated the book testing to take into account #340 2017-07-09 20:02:31 +08:00
Michael Bryan cd11035a69 trivial change to make travis run again 2017-07-09 19:59:29 +08:00
Michael Bryan 8b7c95e02f Made sure the rendered content actually contains the original text 2017-07-09 19:59:29 +08:00
Michael Bryan e3f047a35d Added playpen and mdbook init tests 2017-07-09 19:59:29 +08:00
Michael Bryan 9fab267da1 Added some end-user "sanity" tests 2017-07-09 19:59:29 +08:00
Michal Budzynski b1ca9cf5b5 HtmlConfig is no longer optional
`HtmlConfig` was both guaranteed to exist within `BookConfig`
and `expect`ed in few places.
This simplifies the API a little by representing the fact that
`HtmlConfig` is currently mandatory for proper mdBook binary operation.
2017-06-27 14:01:33 +02:00
Michal Budzynski b3c9ba4555 Correct clippy nits 2017-06-27 09:08:58 +02:00
Michal Budzynski db94b3d839 Add minimal testing for the optional MathJax support 2017-06-25 00:39:57 +02:00
Michal Budzynski 6d8ac6a23c Fixes missing the default "theme" dir location
if not specified in book.toml
2017-06-23 13:29:46 +02:00
Mathieu David 28afebdca2 Merge branch 'minor_refactor' of https://github.com/budziq/mdBook into budziq-minor_refactor 2017-06-23 01:09:26 +02:00
Mathieu David 26fc980ffb Remove 'curly_quotes' key from the json config 2017-06-23 00:48:59 +02:00
Jimmy Do 193f014a5b Add an option to convert to curly quotes when rendering to HTML 2017-06-18 10:11:04 -07:00