Commit Graph

106 Commits

Author SHA1 Message Date
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
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
Jimmy Do 193f014a5b Add an option to convert to curly quotes when rendering to HTML 2017-06-18 10:11:04 -07:00
Michal Budzynski e8908e32c9 Minor cleanup
- removing need to explicitly use `Path::new` all over the place
- removed warnings from doctests (normally invisible unless `cargo test -- --nocapture`)
- no doctests are norun/ignore now
- updated docs both in book-example and in docs not to refer to nonexisting API's
2017-06-14 21:55:42 +02:00
Michal Budzynski 75bbd55128 Changes made with rustfmt including `use_try_shorthand`
Updated the project rustfmt.toml to include `use_try_shorthand = true`.
Run rustfmt on all rust sources.
2017-05-19 13:04:37 +02:00
Corey Farwell 95fd292b4f Address warnings found by rust-clippy.
https://github.com/Manishearth/rust-clippy
2017-02-16 16:55:28 -05:00
Matt Brubeck 894a03655e Simplify error handling in utils::fs 2016-12-31 23:12:38 -08:00
Denis Kolodin b0d33e76ec Remove unused metadata import 2016-11-01 11:19:08 +03:00
Rodrigo Lourenço 528945d67d Copy files with no extension too. 2016-09-23 15:09:16 +01:00
Gambhiro b584f6eb9c use macros from the log crate, issue #151 2016-08-14 13:34:02 +01:00
Boris-Chengbiao Zhou e861880f95 Implement Serve feature 2016-04-02 05:20:46 +02:00
Mathieu David c3564f1699 Add convenience function to read the content from a file into a string given a path 2016-03-27 18:40:50 +02:00
Mathieu David 15d26befcc Refactor: Move extern crate definitions to lib.rs 2016-03-27 18:22:17 +02:00
Mathieu David 74fff81e4b Refactor: Move fs related functions from utils into their own submodule 2016-03-17 22:41:00 +01:00
Mathieu David ad0794a0bd Add a rustfmt config and run rustfmt on the code base 2016-03-17 22:31:28 +01:00
Mathieu David 3fd1d4606c Fix tests after removing PathExt from utils 2016-01-03 14:08:17 +01:00
Mathieu David 78e1897b47 Remove code that has better equivalent in std
Path_Ext has been stabilized in the Standard Library, the temporary copy I had can go.

I found a fs::create_dir_all method that does exactly what create_path was doing, but better... create_path is thus replaced with that.
2016-01-03 13:02:04 +01:00
Mathieu David d000fc8bac Updated pulldown-cmark to version 0.0.5
Version 0.0.5 contains table and footnotes support, both options are now enabled in mdBook.
2016-01-03 12:02:39 +01:00
Mathieu David e40b293336 Fix #70 render inline code blocks in the sidebar 2015-12-30 00:46:55 +01:00
Mathieu David c725df3edd Add test and closes #55 2015-09-18 16:12:43 +02:00
Mathieu David 0a50d6b33f Fixed the error in copy_files_except_ext #55 2015-09-18 15:28:58 +02:00
Mathieu David 103048c0d1 Merge branch 'master' of https://github.com/azerupi/mdBook 2015-09-17 19:45:36 +02:00
Mathieu David b7bcf2e246 Files other than .md are now copied to the output dir Fixes #52 + Added max-width in css for images 2015-09-17 19:45:06 +02:00
mdinger b164e0709b Fix many minor warnings found by clippy 2015-09-16 22:48:01 -04:00
Mathieu David 5960050676 Added my first test!! :) For copy_files_except_ext function 2015-09-16 23:39:00 +02:00
Mathieu David 1799ed9ed3 Added utility function to copy all files recursively except files that have an extension present in the ext_blacklist parameter 2015-09-16 19:01:53 +02:00
Mathieu David 262aa91948 Added a utility method to remove all content of a dir but not the dir itelf. Fixes #32 2015-08-16 13:20:10 +02:00
Mathieu David a5aa357f57 Clean-up: Remove all 'hacky' exist checks and replace by 'exists()' 2015-08-13 10:46:56 +02:00
Mathieu David abae21527a Copied the PathExt trait from the rust source code as temporary fix. Now I can replace the hacky code I used. When it goes to rust stable I will just have to remove and eventually change some 2015-08-13 10:00:44 +02:00
Mathieu David bf114d7e21 Removed the sub module from utils and put the functions directly in the utils module + docs #30 2015-08-06 23:04:19 +02:00
Mathieu David 1095e7c773 Clean-up handlebars renderer, move some parts to utils module 2015-08-04 16:52:10 +02:00
Mathieu David 22280bbb16 Add debug! macro that can be activated using the "debug" feature. #19 2015-08-03 18:06:01 +02:00
Mathieu David c64824a18c Added author and dest field in book.json, fixed bug when output directory did not exist. Closes #7 2015-08-03 14:23:32 +02:00
Mathieu David 5bd1385212 Added a utils module for general / common functions 2015-07-30 15:20:55 +02:00