Commit Graph

177 Commits

Author SHA1 Message Date
Carol (Nichols || Goulding)
a873d46871 Implement a markdown renderer (#1018)
Use case: when trying to `mdbook test` a file that has many `include`
directives, and a test fails, the line numbers in the `rustdoc` output
don't match the line numbers in the original markdown file.

Turning on the markdown renderer implemented here lets you see what is
being passed to `rustdoc` by saving the markdown after the preprocessors
have run.

This renderer could be helpful for debugging many preprocessors, but
it's probably not useful in the general case, so it's turned off by
default.
2019-08-30 12:20:53 +02:00
Michael Bryan
bb412edf53
Made sure the tests pass 2019-07-21 04:32:28 +08:00
Michael Bryan
d1b5a8f982
The MDBook::build() method no longer cleans the renderer's build directory 2019-07-21 02:35:18 +08:00
Jeremy Stucki
92a7b0cdcd
Use iterator instead of for loop 2019-06-20 15:12:56 +02: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
3cfed10098 Update to pulldown-cmark 0.5. (#898)
* Update to pulldown-cmark 0.4.1.

* Update to pulldown-cmark 0.5.2.

* Remove pulldown-cmark-to-cmark dependency.

Since it is not compatible with the new pulldown-cmark. This example isn't
directly usable, anyways, and I think the no-op example sufficiently shows how
to make a preprocessor.

* cargo fmt

* Fix example link.
2019-06-11 18:26:24 +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
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
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
lzutao
581187098c Deny 2018 edition idioms globally (#911) 2019-05-06 22:50:34 +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
b30b58b565
Merge pull request #889 from s3bk/master
new "Book" theme
2019-05-04 17:45:37 +02:00
Dylan DPC
7e26a8430d
Update mod.rs 2019-05-03 19:59:58 +02:00
Dylan DPC
f01fe854fa
Merge pull request #883 from anp/custom_summary
Expose API for building a book with a custom Summary.
2019-04-30 00:25:03 +02:00
Carol (Nichols || Goulding)
d7c7d91005
Write preprocessed content to file before testing with rustdoc
Fixes #855.
2019-03-23 08:35:44 -04:00
Sebastian Köln
9b6f5a9840 add Book theme (Liberation fonts need to be in /fonts/ on the server) 2019-03-20 15:21:36 +01:00
Adam Perry
37808b7e08 Expose API for building a book with a custom Summary.
This is useful for situations where you'd like to
supplement or replace the existing Summary parsing with
custom filesystem traversal code or other similar changes.
2019-03-04 11:44:00 -08:00
Rongsong Shen
b37f21a09b Cleanup build directory before preprocessors run to keep files generated by preprocessors 2019-02-16 12:17:26 +08:00
Bas Bossink
991a725c26 Solve the simplest clippy warnings and run rustfmt 2018-12-04 00:10:09 +01:00
Michael Bryan
29f8b791f1
Merge pull request #792 from rust-lang-nursery/custom-preprocessor
WIP: Custom Preprocessors
2018-10-16 00:02:12 +08:00
Jan-Erik Rediger
0c926b3e88 Ensure section numbers are correctly incremented after a horizontal separator (#790)
Fixes #779
2018-09-19 23:33:28 +08:00
Michael Bryan
adec78e7f5
Forgot to implement 3rd party preprocessor discovery 2018-09-19 23:16:11 +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
3688f73052 rustfmt
using rustfmt 0.99.2-nightly
2018-08-21 10:58:44 -05: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
ac38f05bb6 Change template to use new CSS 2018-07-26 15:28:05 -05:00
Matt Ickstadt
0e1787c617 Don't run index preprocessor on mdbook test 2018-07-25 12:19:01 -05:00
Matt Ickstadt
5835da2432 Run rustfmt 2018-07-23 12:47:04 -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
Michael Bryan
4af155e963
Exposed the sections inside a book (#642) 2018-03-14 23:47:17 +08:00
Dylan Maccora
07719a8e0e Adding for content to book.toml on init (#627)
* Obtaining author name from gitconfig

* Writing theme to config on init

* Addressing a FIXME came across

* Add request for book title.
2018-03-14 23:27:56 +08:00
Pawel Duzinkiewicz
b86533b2a1 pulldown-cmark updated to 0.1.2, fixmes removed, new cargo.lock generated. (#639) 2018-03-11 22:17:38 +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
b777a318f7
Expose functionality for creating core types (#578)
* You can now add chapters to a Book

* Made the RenderContext::new() constructor public
2018-01-26 01:11:48 +08:00
Michael Bryan
5379a0bdf8
Made the logging a lot quieter by default (#569) 2018-01-23 01:28:37 +08:00
Michael Bryan
0d146ffa82
Improve SUMMARY parser error messages (fixes #566) (#567) 2018-01-22 20:47: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
9fe19d8f31
Increase Documentation Coverage (#543)
* Added documentation to the `config` module

* Added an example to the `config` module

* Updated the docs in lib.rs regarding implementing backends

* Started writing an alternate backends walkthrough

* Mentioned the output.foo.command key

* Added example output

* Added a config section to the backends tutorial

* Finished off the backends tutorial

* Made sure travis checks mdbook-wordcount

* Fixed the broken link at in the user guide

* Changed how travis builds the project

* Added a conclusion

* Went through and documented a lot of stuff

* Added a preprocessors chapter and updated For Developers
2018-01-21 22:35:11 +08:00
Michael Bryan
fa84da0856
Stop pulling pulldown-cmark from master (#555)
* Manually implemented PartialEq for pulldown_cmark types

* Fixed an issue where we wouldn't skip a tag properly
2018-01-19 01:21:04 +08:00
Jaime Valdemoros
1136f671a0 Log as each preprocessor is run 2018-01-17 19:05:15 +00:00
Jaime Valdemoros
0d62578c7b Make Preprocessor context store config and root 2018-01-17 09:44:52 +00:00
Jaime Valdemoros
47cc57177d Update comment with rustdoc link 2018-01-16 23:02:50 +00:00
Jaime Valdemoros
90fa1b4909 Turn chained if's into match 2018-01-16 22:39:11 +00:00
Jaime Valdemoros
f2d7b705af Pull out default preprocessors into function 2018-01-16 22:39:11 +00:00
Jaime Valdemoros
b599956516 Move preprocess field location and add tests 2018-01-16 22:39:11 +00:00
Jaime Valdemoros
08027b86cc Revert reordering 2018-01-16 22:39:11 +00:00