Commit Graph

314 Commits

Author SHA1 Message Date
Michael Bryan
8c30de16d6 Used the Entry API to make id counter incrementing nicer 2017-06-20 11:15:12 +08:00
Michael Bryan
fa95546988 Broke the header link wrapping out into smaller functions 2017-06-20 11:06:30 +08:00
Michael Bryan
ac16d7aef1 Added some tests for the original build_header_links function 2017-06-20 10:54:32 +08:00
Michael Bryan
e2a7adaa79 Introduced a RenderItemContext to make item rendering easier
I also accidentally ran `rustfmt` instead of `rustfmt-nightly`, so there are a lot of unnecessary style changes :(
2017-06-20 08:54:39 +08:00
Michael Bryan
75f0196c55 Pulled index rendering out into its own method 2017-06-20 07:53:46 +08:00
Jimmy Do
193f014a5b Add an option to convert to curly quotes when rendering to HTML 2017-06-18 10:11:04 -07:00
Michael Bryan
4af10ce60c Renamed a couple functions to be more descriptive and ran rustfmt 2017-06-17 21:15:54 +08:00
Michael Bryan
deab3ba751 Tiny whitespace changes 2017-06-16 06:50:13 +08:00
Michael Bryan
b7aa78c3c0 Minor refactoring 2017-06-15 18:39:41 +08:00
Michael Bryan
2568986fd5 fixed a typo 2017-06-15 18:17:16 +08:00
Michael Bryan
f946ef6327 Pulled some more little bits out into their own helper functions 2017-06-15 18:03:10 +08:00
Michael Bryan
0d0deb7c40 Pulled page rendering out into its own method 2017-06-15 17:43:44 +08: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
Ning Sun
e890579141 (fix) some merge issue 2017-06-13 20:53:25 +08:00
Ning Sun
6ee6da074e (refactor) rework helpers based on new handlebars api
Signed-off-by: Ning Sun <sunng@about.me>
2017-06-13 20:43:17 +08:00
Ning Sun
2bb274d424 Merge branch 'master' of github.com:azerupi/mdBook 2017-06-13 20:40:46 +08:00
Mathieu David
9ce6eebe43 Merge branch 'master' of git://github.com/Cldfire/mdBook into Cldfire-master 2017-06-12 11:19:31 +02:00
Mathieu David
350c86155b Merge branch 'custom_js' of git://github.com/budziq/mdBook into budziq-custom_js 2017-06-12 11:09:07 +02:00
Michal Budzynski
08fd255a56 Move from localStorage to store.js (v2.0.3)
Fixes a lot of browser incompatibilities in localStorage/cookie handling
Including but not limited to:

- loss of styling and functionality on chromium private mode
- loss of styling and functionality on safari and safari private mode
- awaiting verification if problems in mobile safari are solved.
2017-06-12 01:53:25 +02:00
Michal Budzynski
f96e7e5cba Implemented support for additional JS 2017-06-11 15:08:09 +02:00
Cldfire
44efc65c63 Add Ayu theme
Also adds the a new variable, `$inline-code-color`, to base.styl. The `Ayu` theme needed this to change the text color of inline code.
2017-06-06 16:35:44 -04: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
3a809e4a1c Added local fallback for clipboard.js 2017-05-31 21:51:19 +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
Michał Budzyński
c99ce06370 Do not add playpen boilerplate quick_main! is used
code snippets using quick_main! macro from error-chain
https://docs.rs/error-chain/0.10.0/error_chain/macro.quick_main.html
no longer have `fn main` implicitly added
2017-05-17 22:27:03 +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
4a634f08da Updated google analytics to index.hbs and hbs_renderer.rs 2017-05-16 13:05:21 +08:00
Ning Sun
d1f9174e7f
(feat) adopt new handlebars navigate api
Signed-off-by: Ning Sun <sunng@about.me>
2017-05-05 08:41:50 +08:00
CrazyMerlyn
65d7e86024 Remove the extra run button on runnable rust files
The playpen helper now uses a simple pre block instead of a pre block
with class playpen as it led to nested playpens.
2017-04-16 18:17:59 +05:30
Steve Klabnik
9cb232058b Merge pull request #243 from steveklabnik/gh241
Accept nightly examples.
2017-04-14 15:19:07 -04:00
mthh
df5472ab5a Should fix sections created with chapter of more than two digits 2017-04-07 12:46:28 +02:00
mthh
d768963c30 Revert "should fix sections created with chapter of more than two digits"
This reverts commit 8e7ec6e1fd.
2017-04-07 10:47:45 +02:00
mthh
8e7ec6e1fd should fix sections created with chapter of more than two digits 2017-04-07 02:37:46 +02:00
steveklabnik
80f01d70c6 Accept nightly examples.
This also brings us to parity with rustdoc regarding attributes in
general; while this PR was focused on enabling nightly, that was a
happy accident.
2017-03-31 17:06:03 -04:00
CrazyMerlyn
ed1a216121 Fix header links
Header fragment links now use "id" attribute instead of the depreciated
"name" attribute.

Similar headers are given numbered ids to avoid id collisions.
For instance, if there are three headers named "Example", their ids
would be "#example", "#example-1", and "#example-2" respectively.
2017-03-23 23:24:26 +05:30
steveklabnik
b120ce7397 inject allow(unused_variables) 2017-03-10 09:46:11 -05:00
steveklabnik
c5f9625feb inject main 2017-03-06 13:27:25 -05:00
steveklabnik
79f00eeea3 Implement playpen support for ```rust
Fixes #29
2017-03-06 12:23:15 -05:00
Mathieu David
e218257e42 fix anchor links 2017-02-28 12:42:11 +01:00
Mathieu David
1345c05b18 Fix anchors, Fixes #211 2017-02-28 12:40:05 +01:00
Mathieu David
01341a7705 Fix code blocks with comma separated classes 2017-02-28 01:41:06 +01:00
Mathieu David
58cfef00f2 Merge pull request #209 from steveklabnik/gh204
Print version: fix up header links
2017-02-20 16:12:00 +01:00
Steve Klabnik
6af3eea24b Print version: fix up header links 2017-02-20 09:28:49 -05:00
Mathieu David
d7f38d08fd Merge pull request #205 from frewsxcv/clippy
Address warnings found by rust-clippy.
2017-02-17 11:05:33 +01:00
Steve Klabnik
ec42e2f771 convert to one pass
thanks @burntsushi ❤️
2017-02-16 19:31:52 -05:00
Steve Klabnik
280dabecd7 update regex dep 2017-02-16 17:11:16 -05:00
Steve Klabnik
38b3516b60 Implement links in section headers.
This project already had a transitive dependency on regex; let's use it.

This isn't the most efficient solution, but it should be fine. It ends
up doing five full scans of the text. There's probably an easier way but
I'm mostly just trying to get this to work for now.

This also implements the same algorithm that rustdoc does for generating
the name for the link.

Fixes #204
2017-02-16 17:07:17 -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
f2b87f7944 Factor common io error handling out of renderer 2016-12-31 23:12:38 -08:00
Matt Brubeck
6b2572e78d Simplify some as_str error handling code 2016-12-31 18:41:59 -08:00
Matt Brubeck
fe287a1eca Code cleanup: Remove unnecessary .remove() calls
`BTreeMap::insert` will replace any existing value, so there's no need
to remove the old value first.
2016-12-31 18:33:17 -08:00
Matt Brubeck
3a0cfc87df Add current chapter title to handlebars context 2016-12-31 10:34:36 -08:00
Gambhiro
f67ae7c71a update dependency versions 2016-12-23 08:10:42 +00:00
Gambhiro
85d8e2ebd3 use theme_path key in book.json when given 2016-12-07 14:22:32 +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
Mathieu David
5350d62591 Update all dependencies to latest version 2016-08-01 14:06:08 +02:00
Ian Thompson
b0e5f375ba Make sure <ul><li> and </li></ul> are balanced 2016-07-16 10:23:22 -04:00
Mathieu David
15d6227a11 Attempt to fix #119 replace \ with / in paths, so that Windows also uses / as separator (ugly hack) 2016-04-25 17:02:47 +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
Jesse Stricker
330b1ad55d Add description config option 2016-02-25 14:32:49 +01:00
Jesse Stricker
f508db6113 Add favicon support to theme 2016-02-22 17:17:07 +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
2a7463c45b #29 Add a way to escape {{#playpen ... } using a backslash in front: \{{#playpen ... }} 2016-01-01 01:40:37 +01:00
Mathieu David
0ac0301d72 Continue #29, Rust files can now be loaded with {{#playpen file.rs}}, they will be displayed as other code snippets included with markdown backticks except they have a playpen css class 2015-12-31 19:25:02 +01:00
Mathieu David
38b2dee17e Continue #29 Check that the rust file exists and read to string 2015-12-31 14:14:56 +01:00
Mathieu David
0cb234de5d Add tests for find_playpens 2015-12-31 12:02:25 +01:00
Mathieu David
ee4a7fb35c Start implementing #29 support for embedding playpen, implemented the function that parses the markdown to find playpen links 2015-12-30 22:40:23 +01:00
Mathieu David
e40b293336 Fix #70 render inline code blocks in the sidebar 2015-12-30 00:46:55 +01:00
asolove
5b289c1303 Fix 0ffd638 with smarter way to join with linebreaks. 2015-12-27 14:24:42 -07:00
asolove
0ffd638904 Add newlines back in to generated index.html files. 2015-12-27 14:10:13 -07:00
Mathieu David
4ca6693a48 Update handlebars from 0.11.x to 0.12.x 2015-12-15 18:58:34 +01: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
195bfd2f7f Merge pull request #48 from mdinger/dark_theme
Multiple themes
2015-09-14 17:49:29 +02:00
Mathieu David
5a3155aba7 Fix #50 base url sometimes not correct for index.html 2015-09-14 17:45:30 +02:00
mdinger
872f9ea5e6 Add tomorrow night as dark code highlighting theme 2015-09-14 05:08:48 -04:00
Mathieu David
13e5e862ce Local fallback for Font Awesome #46 2015-09-13 20:03:34 +02:00
Mathieu David
95dfff008c Local fallback for jquery #46 2015-09-13 19:16:11 +02:00
Mathieu David
a050d9c4ad Big refactoring, now using enum for different book items (Chapter, Affix, Spacer, ...) Closes #9 2015-09-11 20:52:55 +02:00
Mathieu David
82a774c90e prevent page break in code blocks + force wrap in pre tags (because you can't scroll...) 2015-09-05 17:39:00 +02:00
Mathieu David
d03ae79765 Added a page containing the whole book for printing purposes, closes #41 + cleaning root path 2015-09-05 17:26:32 +02:00
Mathieu David
be7c0bd059 Clean up of the Renderer trait, render now borrows the book instead of the config and the book items... 2015-08-31 15:24:42 +02:00
Mathieu David
10d756eff0 Fix #40 where next helper returned a link to the current chapter instead of the next 2015-08-12 19:22:53 +02:00
Mathieu David
0932bfd576 Big clean-up, reduced the unwrap's to 2 in the library part! Closes #36 The unwraps where replaced with more diverse error messages #14 2015-08-11 22:55:51 +02:00
Mathieu David
835c61c7f3 Some clean-up + initial implementation of '--theme' flag for init. Still needs some work 2015-08-11 16:13:41 +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
a0040733e9 Fixed rust example in doc + some tweaks for html validation 2015-08-06 14:09:55 +02:00
Mathieu David
05ab31d882 Fix #34 2015-08-06 13:58:27 +02:00
Mathieu David
01369ea42f Checked the API, moved handlebars theme handling to the theme module to expose it to every renderer. Closes #28 2015-08-05 22:35:26 +02:00
Mathieu David
58d18d467c Fixed a bug where custom theme was appended to default theme + Changed syntax highlighting theme to something lighter, the dark theme did not fit the light style of the page 2015-08-05 19:14:03 +02:00
Mathieu David
90719f721b Added syntax highlighting with highlight.js Closes #31 + Added a new chapter to the docs #30. 2015-08-05 18:28:59 +02:00
Mathieu David
2c22d11bfd It's now possible to use a custom theme. Add a theme directory in your src and selectively overwrite the files you want to customize. Closes #6 2015-08-04 17:58:09 +02:00
Mathieu David
4ead44457a Added a new macro 'output' that can be disabled by a feature 2015-08-04 17:13:24 +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
bca6a7aa13 [Clean-up] Reorganize structure in handlebars renderer 2015-08-04 15:15:36 +02:00
Mathieu David
842196b91c Cleaned up the handlebars helpers, it's a lot more customizable because the user can put whatever template he wants inside and I just expose link and name of previous / next chapter. JavaScript part is removed. #26 2015-08-04 12:52:32 +02:00
Mathieu David
a77fe94c02 Started to clean the 'previous' and 'next' handlebars helpers #26 But got stuck, waiting for a response 2015-08-03 22:09:26 +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
5b11907a56 Added navigation icons + javascript code to hide them when there is no previous or next. Closes #12 2015-08-01 14:18:25 +02:00
Mathieu David
c64f3ac973 Added handlebars helpers for navigation, need to find a place where to put them on the page #12 2015-07-31 18:34:43 +02:00
Mathieu David
31f638eae3 Add active class to currently viewed chapter in the sidebar. Closes #20 2015-07-31 15:06:08 +02:00
Mathieu David
1a8c2259e5 Split the handlebars renderer in his own module because it was becoming large 2015-07-30 15:38:21 +02:00