Commit Graph

177 Commits

Author SHA1 Message Date
Jaime Valdemoros
b98ed3f794 Clean up LinkPreprocessor exports and use explicit PreprocessorContext struct 2018-01-16 22:39:11 +00:00
Jaime Valdemoros
9c922cf26b Add LinkPreprocessor::new constructor 2018-01-16 22:39:11 +00:00
Jaime Valdemoros
144358bec6 Change name of link preprocessor 2018-01-16 22:39:11 +00:00
Jaime Valdemoros
4cc708e00f Preprocess links by default 2018-01-16 22:39:11 +00:00
Jaime Valdemoros
12815fe399 Add pre-processing step to build method of MDBook 2018-01-16 22:39:11 +00:00
Jaime Valdemoros
966811061b Start determining preprocessors 2018-01-16 22:39:11 +00:00
Jaime Valdemoros
cad76a9f6c Factor out replace_all preprocessor 2018-01-16 22:39:11 +00:00
Jaime Valdemoros
01df904bb3 Initial Preprocessor trait implementation 2018-01-16 22:39:11 +00:00
Michael Bryan
a1b6ccc29a
Override configuration using environment variables (#541)
* Added the ability to update config settings from env vars

* Added tests

* Documented that you can override configuration with environment
variables

* Refactored the config get() methods to use toml-query

* Made the `Updateable` trait more generic
2018-01-14 02:38:43 +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
Michael Bryan
cba16a0083
Updated dependencies and made logging more readable 2017-12-30 18:43:46 +08:00
Michael Bryan
718d251c7f
Added a warning if people use the book.json config file 2017-12-13 11:55:37 +11:00
Michael Bryan
75dac15f09
Fixed a couple issues with the docs 2017-12-11 18:50:31 +11:00
Michael Bryan
ff9e0b0add
Made sure create_missing also creates the parent directory 2017-12-11 17:29:32 +11: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
ebcf41c25b
Improved error messages using error_chain::ChainedError::display_chain() 2017-12-11 11:42:36 +11:00
Michael Bryan
1b51cd244e
Moved the book examples to the top level lib.rs 2017-12-11 11:29:30 +11:00
Michael Bryan
be4654c9c2
Fleshed out the docs for the book module 2017-12-11 11:24:43 +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
527fc5cf79
Completely removed the create_missing option from MDBook 2017-12-10 22:52:20 +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
cafb8b75e7
The library not compiles (probably completely broken) 2017-12-10 22:44:20 +11:00
Michael Bryan
4c6c696c87
Copied across the summary parser and Book structure (doesn't compile) 2017-12-10 22:43:12 +11:00
Michael Bryan
8ee795045a
Added a quick fix so if the config isn't found we use a default 2017-12-09 20:36:23 +11:00
Michael Bryan
e735bc6d3e
Merge pull request #500 from cspiegel/create-missing
WIP: Add a create-missing option to book.toml.
2017-12-06 00:30:49 +08:00
projektir
32df76d077 Adding a header partial integration #453 2017-11-30 21:48:29 -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
Chris Spiegel
93874edebf Add a create-missing option to book.toml. 2017-11-29 20:02:58 -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
Michael Bryan
b74c2c18ef
Removed all references to old the configuration from the html renderer 2017-11-12 21:37:36 +08:00
Michael Bryan
c056b5cbd0
Removed old configs from MDBook 2017-11-12 21:37:36 +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
40a4840867 [book] Prevent over-matching in gitignore rule
To only ignore the output destination (default: `book`) and no other
file/directory with the same name under the mdbook root, we should
prefix the gitignore rule with a leading slash (default: `/book`).
2017-08-30 16:01:45 -07:00
Michal Budzynski
ddf31dcc08 Fixed mdbook test for {{#playpen file.rs}}
- now `mdbook test` does full link expansion to temp file prior to running
- also minor reformat and cleanup of `HtmlHandlebars::render_item`
2017-08-07 21:42:28 +02:00
projektir
16aa545c5b Integrating Ace #247 2017-08-03 22:45:33 -04:00
messense
7c023e2d1d
Add library path argument for mdbook test 2017-06-28 10:33:52 +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
Mathieu David
c9a117cc4e Merge pull request #361 from Michael-F-Bryan/error-chain
Add error-chain throughout the codebase
2017-06-26 17:07:51 +02:00
Michael Bryan
83354ab24b Fixed up some unused-imports warnings 2017-06-25 14:21:23 +08:00
Michal Budzynski
f214c7108f Make MathJax support optional
to enable add following to book.toml
```toml
[output.html]
mathjax-support = true
```
2017-06-25 00:32:33 +02:00
Michael Bryan
1356e0f068 Added error-chain to the book and utils modules 2017-06-25 00:04:57 +08: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
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
f96e7e5cba Implemented support for additional JS 2017-06-11 15:08:09 +02:00
Mathieu David
1a8e54bb52 remove unused methods 2017-06-04 20:41:31 +02:00
Mathieu David
bb4ceb481f Allow an additional custom stylesheets, closes #178 2017-06-04 20:41:31 +02:00
Mathieu David
2e812db13c Fix for google-analytics 2017-06-04 20:41:31 +02:00
Mathieu David
70383d0a25 New config structs supports json again (the old style) for a little deprecation period 2017-06-04 20:41:31 +02:00
Mathieu David
d3ae2eda56 Replace the old book structure with the new one 2017-06-04 20:41:31 +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
Michael-F-Bryan
94dce4f796 Added google_analytics so it can be inserted into handlebars 2017-05-16 13:28:59 +08:00
Michael-F-Bryan
ada1f29b34 Added a google_analytics field to BookConfig
This commit:
- Adds an Option<String> field to the BookConfig which should
  contain your google analytics ID
- Allows the google analytics ID to be extracted from the config
  file (key is google_analytics_id)
- Adds a test to make sure the field is populated from a config
  file correctly
2017-05-16 13:15:04 +08:00
Corey Farwell
4f4120b5a4 Fix incorrect conditional.
I accidentally introduced this in 4525810737.
2017-04-27 09:16:19 -04:00
Corey Farwell
4525810737 Rewrite an emptiness check. 2017-04-17 21:58:34 -04:00
Corey Farwell
5d72d966ad Wrap long line. 2017-04-17 21:56:01 -04:00
Corey Farwell
15dcca87d8 Refactor to prevent excessive indentation. 2017-04-17 21:55:32 -04:00
Corey Farwell
c6e81337fb Implement new 'no-create' build flag.
Fixes https://github.com/azerupi/mdBook/issues/253.
2017-04-17 21:53:27 -04:00
Tshepang Lekhonkhobe
793a88260c move misplaced example 2017-03-30 14:09:14 +02:00
Corey Farwell
cfa4295d79 Bump toml crate to 0.3. 2017-02-18 20:22:55 -05:00
Corey Farwell
95fd292b4f Address warnings found by rust-clippy.
https://github.com/Manishearth/rust-clippy
2017-02-16 16:55:28 -05:00
Corey Farwell
152ebba762 Bump serde, serde_json, and handlebars crates. 2017-02-15 23:31:05 -05:00
Matt Brubeck
09729aaca5 Clean up some Path code in bookconfig 2017-01-01 16:02:48 -08:00
Matt Brubeck
f2b87f7944 Factor common io error handling out of renderer 2016-12-31 23:12:38 -08:00
Matt Brubeck
712adcf737 Fix cfg attribute in bookconfig_test 2016-12-31 10:36:19 -08:00
Gambhiro
8a178e311d fix test 2016-12-24 13:44:24 +00:00
Gambhiro
53ec61ac70 upd example 2016-12-24 13:34:22 +00:00
Gambhiro
97d46e79b7 convert json to toml before config parsing 2016-12-24 13:22:01 +00:00
Gambhiro
791487bc84 parse either book.toml or book.json 2016-12-23 08:15:32 +00:00
Gambhiro
85d8e2ebd3 use theme_path key in book.json when given 2016-12-07 14:22:32 +00:00
Gambhiro
a9e5dc63f1 use src key in book.json when given 2016-12-07 09:38:56 +00:00
Mathieu David
d2f3eb5007 remove unused imports 2016-11-03 02:05:35 +01:00
Mathieu David
67aee5c192 Switch from rustc_serialize to serde. Closes #18 2016-11-03 01:58:42 +01:00
Gambhiro
db11ff27f4 use warn 2016-08-14 14:40:08 +01:00
Gambhiro
b584f6eb9c use macros from the log crate, issue #151 2016-08-14 13:34:02 +01:00
Boris-Chengbiao Zhou
9b1e224680 Fix no-default-features build 2016-05-08 21:51:34 +02:00
Mathieu David
e34bef0e53 (Refactor) Move mdbook.rs to mod.rs 2016-04-26 23:04:27 +02:00
Mathieu David
1b8af2bf57 Fix #120 destination and source directories can now be constructed correctly even if multiple directories do not exist on the path 2016-04-25 15:58:44 +02:00
Mathieu David
876ea7895a Fix #131 where src and dest paths were not prefixed with the root directory if it was not the current directory 2016-04-25 15:50:34 +02:00
Mathieu David
2ec5648587 Remove BookConfig field from MDBook
MDBook now stores the necessary information, BookConfig is not used as a field anymore. It is only used for parsing the configuration file. This allows to more easily replace the book.json config with the new tomlbased config
2016-04-05 12:44:14 +02:00
Boris-Chengbiao Zhou
e861880f95 Implement Serve feature 2016-04-02 05:20:46 +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
vrinek
bc41efe414 Move .gitignore directly under the root folder 2016-03-07 08:52:19 +00:00
Mathieu David
73ce3f814a Merge branch 'init-with-gitignore' of https://github.com/vrinek/mdBook into vrinek-init-with-gitignore 2016-03-02 19:20:21 +01:00
vrinek
1eb59428e6 Ask user to create .gitignore and skip on --force 2016-02-28 15:28:11 +00:00
Jesse Stricker
330b1ad55d Add description config option 2016-02-25 14:32:49 +01:00
vrinek
596455f28c Generate simple .gitignore on init 2016-02-23 14:03:45 +00:00
Jesse Stricker
88fabd76f0 Copy favicon on 'init --theme' 2016-02-22 17:20:54 +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