Commit Graph

78 Commits

Author SHA1 Message Date
Sorin Davidoi d306aed587 Accessibility improvements (#611)
* fix(theme/book/themes): Check for control keys in event listener

* fix(theme/index): Menu role for theme selector

* fix(theme/book/themes): Handle focus when toggling theme list

* feat(theme/book/themes): Handle ArrowUp, ArrowDown, Home and End
2018-02-15 07:37:19 +08:00
Sorin Davidoi 674e58e747 fix(theme): Use aria-label alonside title (#568)
Tested this on macOS with VoiceOver, and it does not pick up the title as the text of the button. Kind of makes sense, since title and aria-label are not the same. This will make sure that the buttons and links are labeled properly.
2018-01-27 18:52:47 +08:00
Sorin Davidoi 186e649530 feat(src/theme): Scrollbar theme (#563) 2018-01-26 01:17:02 +08:00
Sorin Davidoi 0531b585e4 fix(theme/index): Use localStorage, not store (#574)
* fix(theme/index): Use localStorage, not store

* fix(theme/index): Handle quotes values in localStorage
2018-01-23 20:30:50 +08:00
Sorin Davidoi 0bc3544c81 refactor: Remove store.js (use localStorage) (#550) 2018-01-22 07:04:16 +08:00
Sorin Davidoi 80f42675d6 feat(theme/stylus/menu): Make sticky (#551)
* feat(theme/stylus/menu): Make sticky

* feat(theme/stylus/menu): Faint bottom border

* feat(theme/book): Auto hide menu when scrolling down

* feat(theme/stylus/menu): Don't hide title

* feat(theme/stylus/menu): Only show bottom border when sticky

* fix(theme/stylus/menu): Don't hide when sidebar is expanded

* feat(theme/book): Show menu bar on hover
2018-01-19 23:41:50 +08:00
Sorin Davidoi 5a4adcce53 refactor(theme): Remove jQuery 2018-01-16 16:31:08 +01:00
Sorin Davidoi b0e91193e9 Meta theme color (#547)
* feat(theme/index): Add meta tag for theme-color

* feat(theme/book): Sync theme-color meta tag with the current theme
2018-01-16 20:29:20 +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 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
Mario Nebl 7c81335c9a Use <button> for menu bar (#523) 2018-01-04 17:19:20 +08:00
Shane Nelson 31fb443562 Cleanup and various fixes 2017-12-18 00:14:25 -05:00
Shane Nelson 71689da6b1 Force hidden sidebar on load for screen widths smaller than sidebar plus content and simplify styles 2017-12-17 23:04:30 -05:00
lifta42 9143110a43 Optimized the stylesheet for better performance 2017-12-06 16:20:22 +08:00
projektir 32df76d077 Adding a header partial integration #453 2017-11-30 21:48:29 -08:00
François aecc403fb8 add tooltip to icons (#477)
add tooltip to icons and previous/next chapter links
2017-10-27 14:46:55 +02:00
Mathieu David cd711bfb1c Merge pull request #456 from Michael-F-Bryan/conditional-ga
Conditional Google Analytics
2017-10-18 14:10:53 +02:00
Michael Bryan a554390aa2 Slightly cleaned up the google analytics tag (skip ci) 2017-10-09 09:53:02 +08:00
Michael Bryan ac9c150902 Moved custom JS to the bottom 2017-10-04 19:59:10 +08:00
Michael Bryan f2e56c887b Got the logic around the wrong way 2017-10-04 19:57:06 +08:00
Michael Bryan b4a12fa723 Made sure google analytics isn't included when inspecting locally 2017-10-04 19:57:06 +08:00
steveklabnik 9b64db908f prefix sidebar too 2017-09-22 13:58:45 -04:00
steveklabnik f562878131 I forgot one theme, thanks budziq 2017-09-22 13:56:58 -04: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 881a1b39ff Remove the logic in handlebars and expose the 3 different titles in the handlebars variables 2017-09-07 23:19:22 +02: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
projektir 16aa545c5b Integrating Ace #247 2017-08-03 22:45:33 -04: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
Mathieu David 49336e0698 Merge branch 'master' of github.com:azerupi/mdBook 2017-06-18 19:21:08 +02:00
Mathieu David cff1ed5e08 remove #content 2017-06-18 19:19:48 +02:00
Mathieu David 73c845fbbe Merge branch 'master' of git://github.com/jmillikan/mdBook into jmillikan-master 2017-06-18 19:14:32 +02:00
Michal Budzynski c1c06d6dc1 Auto focus on content to allow keyboard navigation 2017-06-15 23:15:41 +02: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
Michal Budzynski 3a809e4a1c Added local fallback for clipboard.js 2017-05-31 21:51:19 +02:00
Michal Budzynski e567d22f1c Initial implementation of clipboard handling 2017-05-31 19:56:17 +02:00
Michael-F-Bryan 4a634f08da Updated google analytics to index.hbs and hbs_renderer.rs 2017-05-16 13:05:21 +08:00
Phil Ruffwind 3066597acc Change MathJax to use CDNJS
Because the MathJax CDN will soon be retired.
2017-05-05 17:08:59 -04:00
Vincent Esche 41735b4579 Added monospace font with support for box-drawing chars 2017-04-15 14:16:28 +02:00
Jesse Millikan d24ad83a5c Empty header sections 2017-04-14 15:51:23 -04:00
Jesse Millikan 980ea5796e next and prev attributes on the next and prev links, and #content 2017-03-19 16:21:38 -04:00
Jesse Millikan 8500d1c8a7 Relative links for non-JS browsers 2017-03-19 03:53:24 -04:00
Matt Brubeck 3a0cfc87df Add current chapter title to handlebars context 2016-12-31 10:34:36 -08:00
Onur Aslan b9e22bb8f2 Use light theme when javascript is disabled
mdBook is setting theme (by adding a class attribute to body tag) with javascript.
Page is not using any theme by default and page is not using any styling unless
javascript is enabled.

This patch is adding class attribute to body tag and making mdBook to use `light`
theme when javascript is disabled.

Fixes: #144
2016-06-15 17:25:28 +03:00
Boris-Chengbiao Zhou e861880f95 Implement Serve feature 2016-04-02 05:20:46 +02:00
Lucio Franco ceb139a848 Moved CDN's to https 2016-03-23 14:16:41 -06:00