Commit Graph

189 Commits

Author SHA1 Message Date
Michael Bryan b5ea84c60d
Remove unnecessary travis jobs (#664)
* Removed all the unnecessary CI jobs

* Updated dependencies

* Removed a deprecation warning
2018-04-07 15:47:08 +08:00
Matt Ickstadt 5fb3675151 Update elasticlunr-rs (#646)
* Update dependencies

* Use config structs from elasticlunr-rs

* Update searchindex fixture
2018-03-20 20:22:35 +08:00
Michael Bryan 867fbfec05
Updated the call site for handlebars rendering 2018-03-14 23:48:56 +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
Steve Klabnik 3ba71c570c Handle input path with regards to custom css (#598)
* Handle input path with regards to custom css

Before, when someone like the Reference set their extra css as
"theme/reference.css" in their book.toml, this path would be treated as
relative to the invocation of mdbook, and not respect the input path. This
PR modifies these relative paths to do so.

Fixes the build of https://github.com/rust-lang/rust/pull/47753 which
blocks updating rustc to mdbook 0.1

* don't use file-name

the style name is theme/reference.css, this results in a Err(StripPrefixError(())), which means that we push only the file_name, losing the theme bit
2018-01-30 12:29:09 +08:00
Michael Bryan ffb90bb9e2
Made sure we create the themes directory (#586) 2018-01-26 14:38:53 +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 bda23f0183
Missing backends are no longer fatal 2018-01-25 01:15:29 +08:00
Michael Bryan 5379a0bdf8
Made the logging a lot quieter by default (#569) 2018-01-23 01:28:37 +08:00
Sorin Davidoi 0bc3544c81 refactor: Remove store.js (use localStorage) (#550) 2018-01-22 07:04:16 +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 232a923676
Added a windows-specific `tee` equivalent (#561)
* Added a windows-specific `tee` equivalent

* Changed how the windows "tee" command gets quoted

* Temporarily disabled the backends_receive_render_context_via_stdin test
2018-01-20 21:46:44 +08:00
Sorin Davidoi 3d1a311638 refactor: Remove jQuery file (#562) 2018-01-20 15:56:32 +08:00
Jaime Valdemoros cad76a9f6c Factor out replace_all preprocessor 2018-01-16 22:39:11 +00:00
Michael Bryan be9a524eeb
Made sure the CmdRenderer always creates the destination dir 2018-01-16 21:39:59 +08:00
Sorin Davidoi 61fad2786b Improve accessibility (#535)
* fix(theme/index): Use nav element for Table of Content

* fix(renderer/html_handlebars/helpers/toc): Use ol instead of ul

Chapters and sections are ordered, so we should use the appropriate HTML tag.

* fix(renderer/html_handlebars/helpers/toc): Hide section number from screen readers

Screen readers have this functionality build-in, no need to present this. Ideally, this should not even be in the DOM tree, since the numbers can be shown by using CSS.

* fix(theme/index): Remove tabIndex="-1" from .page

Divs are not focusable by default

* fix(theme): Make sidebar accessible

Using aria-hidden (together with tabIndex) takes the links out of the tab order.
http://heydonworks.com/practical_aria_examples/#progressive-collapsibles

* fix(theme/index): Wrap content inside main tag

The main tag helps users skip additional content on the page.

* fix(theme/book): Don't focus .page on page load

The main content is identified by the main tag, not by auto-focusing it on page load.

* fix(theme/index): Make page controls accessible

* fix: Make theme selector accessible

- Use ul and li (since it is a list)
- Add aria-expanded and aria-haspopup to the toggle button
- Use button instead of div (buttons are accessible by default)
- Handle Esc key (close popup)
- Adjust CSS to keep same visual style

* fix(theme/stylus/sidebar): Make link clickable area wider

Links now expand to fill the entire row.

* fix(theme): Wrap header buttons and improve animation performance

Previously, the header had a fixed height, which meant that sometimes the print button was not visible. Animating the left property is expensive, which lead to laggy animations - transform is much cheaper and has the same effect.

* fix(theme/stylus/theme-popup): Theme button inherits color

Bug introduced while making the popup accessible

* fix(theme/book): Handle edge case when toggling sidebar

Bug introduced when switching from animating left to using transform.
2018-01-15 21:26:53 +08:00
Michael Bryan 9ab54412ea
Made it so the CmdRenderer writes directly to the child's stdin (#544) 2018-01-14 19:14:27 +08:00
vabc3 e825357848 Add option to disable section label in html (#533) 2018-01-08 00:31:46 +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
Jan Likar dedc208a6a Prohibit 'print.md' files (#524)
* Prohibit 'print.md' files

Fix #258 by emmiting an error whenever an mdBook contains a
"print.md" file in its root.

* Apply suggested changes

* Add tests
2018-01-07 00:02:23 +08:00
Michael Bryan 89eff2d824
Added better error messages for missing CSS/JS 2017-12-14 20:03:17 +11:00
Michael Bryan be4654c9c2
Fleshed out the docs for the book module 2017-12-11 11:24:43 +11:00
Michael Bryan 751da4f05f
Added a test to make sure you can include rust files in chapters 2017-12-10 22:59:35 +11:00
Michael Bryan f993677626
All tests finally pass! 2017-12-10 22:52:00 +11:00
Michael Bryan cafb8b75e7
The library not compiles (probably completely broken) 2017-12-10 22:44:20 +11:00
projektir 32df76d077 Adding a header partial integration #453 2017-11-30 21:48:29 -08:00
Jacob Wahlgren 3d5eb48e32 Refactor navigation helpers (#465)
* Refactor navigation helpers

* Target::find: take previous_item by reference

This makes more sense for find as an interface, though it causes a
second clone in some cases. Maybe rustc is smart here?

* Test next and previous navigation helpers

* Add more next/previous tests
2017-11-18 19:17:26 +08:00
Michael Bryan 3aa6436679
Added in things from @Phaiax's review 2017-11-12 21:37:38 +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
Jacob Wahlgren 7e5892bd35 Ignore unhelpful clippy warning
As discussed in https://github.com/azerupi/mdBook/pull/466
2017-10-12 22:14:48 +02:00
Jacob Wahlgren 8f6523a94c Fix some clippy warnings 2017-10-07 18:11:05 +02:00
Pratik Karki 382fc4139b run rustfmt on the repository #398(Updated) (#438)
rustfmt the repository #398
2017-10-03 13:40:23 +02:00
Steve Klabnik a3b6e549e2 Merge pull request #440 from budziq/force_runnable
added `mdbook-runnable` infostring support
2017-09-14 12:48:29 -04:00
Michal Budzynski c056df597a added `mdbook-runnable` infostring support
makes `ignore`'d playpens runnable
2017-09-13 22:54:01 +02:00
Mathieu David 0d6adc5fc9 Fix the issue with pages named print not at the root 2017-09-13 22:17:23 +02:00
Mathieu David ef5895fa78 Update all dependencies 2017-09-11 19:38:10 +02:00
Mathieu David 84ef4d2617 preserve dashes when generating anchors and trim whitespace 2017-09-08 19:59:04 +02:00
Mathieu David 016ec8836c Merge pull request #415 from azerupi/fix-print-title
Fix the print title that was using the title from the last rendered chapter
2017-09-07 23:29:54 +02:00
Mathieu David 881a1b39ff Remove the logic in handlebars and expose the 3 different titles in the handlebars variables 2017-09-07 23:19:22 +02:00
Behnam Esfahbod ddee839d9c [renderer] Err on bad file names, instead of panic
Addressing the review comments.
2017-09-06 02:25:10 -07:00
Behnam Esfahbod 99945542ca [renderer] Add normalize_path()
On the web, the normalized path separator is forward-slash (`/`), so we
use the built-in `is_separator()` method to replace any path separator
with the forward-slash, to ensure consistent output on unix and windows
machines.
2017-09-06 00:52:17 -07:00
Behnam Esfahbod 956a5cc7fd Fix heading links in nested pages
Plus fixing the whitespace chars not being replaced by hyphen.

Also expand tests for link creations, and add test for nested pages.

Fixes <https://github.com/azerupi/mdBook/issues/416>
Fixes <https://github.com/azerupi/mdBook/issues/417>
2017-09-06 00:52:17 -07:00
Mathieu David 0a4a2b66da Fix the print title that was using the title from the last rendered chapter. Fixes #414 2017-09-01 08:22:24 +02: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
Mathieu David 373e36ebfb Merge pull request #380 from ffissore/master
Fixed wrong filename when post processing html
2017-08-03 16:27:18 +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
Michal Budzynski f3f6b40ea9 Moved playpen.rs `renderer` helper to `preprocess/links.rs` module 2017-08-01 13:50:12 +02:00