Commit Graph

83 Commits

Author SHA1 Message Date
Manuel Woelker
d7df832cce fix test and formatting 2020-06-10 15:33:09 +02:00
Manuel Woelker
406b325c54 fix usage of newly stablized inner_deref/as_deref 2020-06-10 13:09:18 +02:00
Manuel Woelker
06efa7a675 additional changes to the 404 mechanism based on feedback:
- removed config output_404
 - ensure serve overrides the site url, and hosts the correct 404 file
 - refactor 404 rendering into separate fn
 - formatting
2020-06-10 12:46:23 +02:00
Eric Huss
6c4c3448e3
Update dependencies. (#1211)
* Removed the itertools dependency

* Removed an unused feature flag

* Stubbed out a toml_query replacement

* Update dependencies.

* Bump env_logger.

* Use warp instead of iron for http server.

Iron does not appear to be maintained anymore. warp/hyper seems to be
reasonably maintained. Unfortunately this takes a few seconds more
to compile, but shouldn't be too bad.

One benefit is that there is no longer a need for a separate websocket
port, which makes it easier to run multiple servers at once.

* Update pulldown-cmark to 0.7

* Switch from error-chain to anyhow.

* Bump MSRV to 1.39.

* Update elasticlunr-rs.

Co-authored-by: Michael Bryan <michaelfbryan@gmail.com>
2020-05-20 23:32:00 +02:00
Eric Huss
c44ef1b2f0 Fix some clippy warnings. 2020-05-10 08:29:50 -07:00
Andrew Mackenzie
c2686a817a Address PR review comments 2020-04-03 10:39:15 -07:00
Andrew Mackenzie
bd14d0910a Avoid a possible recursive copy when destination (build_dir) is underneath source directory. Update docs to match. 2020-04-03 10:39:15 -07:00
Eric Huss
6eb597a556
Revert "Assure copy_files_except_ext(..) won't copy directories into itself (#1135)" (#1181)
This reverts commit d7a2b29f06.
2020-04-03 19:12:43 +02:00
Sebastian Thiel
d7a2b29f06
Assure copy_files_except_ext(..) won't copy directories into itself (#1135)
This prevents recursive copy-loops when the destination directory
is contained in the source directory.

Now it bails out with a descriptive error message.
2020-02-29 19:20:55 +01:00
Eric Huss
2f59943c04 rustfmt with 1.40
Some slight changes in formatting in 1.40.
2019-12-31 16:23:25 -08:00
Marcus Klaas de Vries
2a3088422a Upgrade pulldown_cmark to 0.6.1 2019-11-11 20:25:38 +01:00
Steve Klabnik
f79d5d4582 rust-lang-nursery -> rust-lang
Fixes #1080
2019-10-29 08:04:16 -05: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
Eric Huss
b88839cc25 Rustfmt for 1.38.
A minor change in the recent stable release.
2019-09-26 09:54:12 -07:00
Benoît CORTIER
d29a79349c Add include by anchor in preprocessor. 2019-07-14 21:55:51 -04:00
Eric Huss
228e99ba11 Fix even more print page links. (#963) 2019-07-01 17:52:25 +02:00
Eric Huss
7c33ac800c
Merge pull request #962 from integer32llc/rangebounds
Use stdlib RangeBounds
2019-06-20 20:01:52 -07:00
Carol (Nichols || Goulding)
abddd7c6f7
Use stdlib RangeBounds 2019-06-20 21:56:31 -04: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
2497e77bf1 Support strikethrough and tasklists. (#952) 2019-06-12 17:02:03 +02: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
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
Eric Huss
cb4a3e0711 Fix more print.html links. (#871) 2019-05-08 23:50:59 +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
Carol (Nichols || Goulding)
4abac12c04
Fix deprecation warnings for trim left/right matches 2019-03-23 08:47:10 -04:00
Steve Klabnik
23ac06e2eb Fix a bug in link re-writing
In a regex, `.` means `[0-9a-zA-Z]`, not a period character. This means
that this regex worked, unless a link anchor contained `md` inside of
it. This fixes the regex to match a literal period.

Reported by @ehuss in
https://github.com/rust-lang-nursery/mdBook/pull/866#issuecomment-454595806
2019-01-16 15:44:51 -05:00
Steve Klabnik
2ddbb37f49 Fix the bug 2019-01-15 14:10:02 -05:00
Bas Bossink
991a725c26 Solve the simplest clippy warnings and run rustfmt 2018-12-04 00:10:09 +01:00
Weihang Lo
d729a762fe
Remove insertion on non alphabetic initial headings 2018-09-09 12:00:28 +08:00
Weihang Lo
43b3d157d9
(test) validate id from non ascii headings 2018-09-09 12:00:25 +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
5835da2432 Run rustfmt 2018-07-23 12:47: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
Hiroki Noda
289028850f Use saturating_sub instead of checked_sub.unwrap_or 2018-06-04 01:42:09 +09: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
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
boxdot
bf9f58e11b Add docs for mdBook specific include feature (#593)
* Add docs for mdBook specific include feature.

Also:
* Fix bug in take_lines taking `end`-many lines instead of
  `end-start` many.
* Handle special case `include:number` as including a single line.
* Start counting lines at 1 and not 0.

* Merge mdBook and rust specific features into one chapter.
2018-01-31 18:57:47 +08:00
Michael Bryan
5379a0bdf8
Made the logging a lot quieter by default (#569) 2018-01-23 01:28:37 +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
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
boxdot
e461610dab Implement partial include of source files (#520)
* Implement partial include of source files.

The macro `{{include some_file}}` accepts now optional line number
arguments, s.t. the specified line range is included. The following
forms are supported:

* `{{include some_file::}}` is equivalent to `{{include some_file}}`
* `{{include some_file:from:}}` includes lines [from, infinity)
* `{{include some_file::to}}` includes lines [0, to]
* `{{include some_file:from:to}}` includes lines [from, to]

* Remove the special case IncludeFull which is IncludeFrom(0).

* Use Range, RangeFrom, RangeTo and RangeFull to represent include-ranges.

Also:
* Move out introduced methods as free functions.
* Introduce RangeArgument trait as long it is unstable in stdlib.
* Use itertools for joining of lines on the fly.
* Split tests.
* Simplify include file argument parsing.

* Make utils::string private and link collections_range feature issue.
2018-01-06 05:03:30 +08:00
Anna Liao
5ce05a79be updated links from azerupi to rust-lang-nursery (#489) 2017-11-22 11:35:18 +01:00
Pratik Karki
382fc4139b run rustfmt on the repository #398(Updated) (#438)
rustfmt the repository #398
2017-10-03 13:40:23 +02:00
Michal Budzynski
31983cae6c fixed missing playpen css class when codeblock properties had whitespace 2017-08-11 12:39:27 +02:00
Michal Budzynski
d7ecb1a80c Rewrite of {{#}} links handling in preprocess module
- Replaced link parser with a Regex
- Implemented {{#include}} links
- Will display relatively nice error when cannot open {{#}} linked file
- Escaped links no longer render with escape char
- utils::fs::file_to_path no takes AsRef<Path>
- sorted export/mod in lib.rs
2017-08-01 13:50:12 +02:00
Michael Bryan
83354ab24b Fixed up some unused-imports warnings 2017-06-25 14:21:23 +08:00
Michael Bryan
1356e0f068 Added error-chain to the book and utils modules 2017-06-25 00:04:57 +08:00