Commit Graph

90 Commits

Author SHA1 Message Date
Allen df12cc55c8 Revert "Merge pull request #889 from s3bk/master" (#917)
* Revert "Merge pull request #889 from s3bk/master"

This reverts commit b30b58b565, reversing
changes made to c6220fba83.

* format tests :P
2019-05-09 20:18:28 +02:00
Dylan DPC b30b58b565
Merge pull request #889 from s3bk/master
new "Book" theme
2019-05-04 17:45:37 +02:00
Dylan DPC 357ebcf7ce
Merge pull request #849 from gentoo90/sidebar-resize
Add sidebar resize
2019-04-28 23:29:07 +02:00
Federico Fissore 02fa7b0a11 When the Copy button is pressed, focus is lost and scrolling the page
with the arrow keys stops working. Fixed by upgrading ClipboardJS to
the latest version
2019-04-23 09:29:22 +02:00
Sebastian Köln 9c8fae4704 fix forgotten rename 2019-03-20 15:36:40 +01:00
Sebastian Köln 9b6f5a9840 add Book theme (Liberation fonts need to be in /fonts/ on the server) 2019-03-20 15:21:36 +01:00
gentoo90 3d8db7f25c Disable text selection and CSS transition while resizing sidebar 2018-12-12 21:55:50 +02:00
gentoo90 3d37e24c14 Add sidebar resizing 2018-12-12 21:55:50 +02:00
Jason Liquorish 0c31ab2953 Initial implementation of default theme option 2018-10-12 19:57:59 +01:00
Matt Ickstadt 47f85e71a8 Use stable rust playground API
and also add timeouts to these fetches.
2018-08-01 12:38:36 -05:00
Matt Ickstadt 8ba1830750
Merge pull request #752 from mattico/icon-margin-padding
Icon button hit-test dead-space fix
2018-07-30 19:19:31 -05:00
Matt Ickstadt d054140117 Fix rust playground execute API 2018-07-30 19:17:53 -05:00
Matt Ickstadt 512826c465 Fix hiding theme menu 2018-07-30 19:06:50 -05:00
Matt Ickstadt 29b3ff14c7
Merge pull request #719 from lucasem/patch-1
rustdoc codeblock hash escape
2018-07-24 11:09:28 -05:00
Matt Ickstadt cae8a8ffe2 Only fetch crates list on pages with playpens 2018-07-16 19:17:00 -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
Lucas Morales 374e1d3f94
rustdoc codeblock hash escape
pending merge of rust-lang/rust#51803
2018-07-04 16:54:55 +04:00
Matt Ickstadt f01bf88e69 Fix several theme issues (#648)
* Don't hide page content when displaying search

* Decrease sidebar animation time

* Fix search key event handler
which wasn't completely de-jqueryified.

* Avoid reflowing page content on small screens
This reduces jank caused by reflowing the page text while animating the
sidebar, and it looks nicer.

* Don't use HTMLParentNode.prepend()
since edge doesn't support it yet

* Don't animate menu border bottom color
since it's the same color as the background, which isn't animated.

* Small CSS improvments
- Remove invalid `pointer: cursor` style
- Disable transitions for noscript to stop page from spazzing on every load
- Add `cursor: pointer` to mark
- Disable `cursor: pointer` on noscript menu-title

* JS fixes

- Load MathJax async
- Always use local fontawesome and clipboard.js
- Move js class to html element to make theme switching easier

* Give the print button a bit more margin
2018-04-09 12:10:44 +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
Sorin Davidoi 82aef1bc3f fix(theme/book): Workaround focusout bug in macOS and iOS (#630) 2018-02-24 17:23:45 +08:00
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 990daceed5 feat(theme/book): Scroll to top when clicking the page title (#613)
Common pattern, especially on mobile devices where the page can be quite long.
2018-02-09 18:34:18 +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 f082187844 fix(theme/book): Use passive listeners for touchstart, touchmove (#575) 2018-01-25 18:44:22 +08:00
Sorin Davidoi bcfb37d964 fix(theme): Sticky header support in Safari (#572)
Safari scrolls on body, not on the html tag. It also needs sticky to be prefixed.
2018-01-23 21:13:11 +08:00
Sorin Davidoi 0bc3544c81 refactor: Remove store.js (use localStorage) (#550) 2018-01-22 07:04:16 +08:00
Sorin Davidoi 05e4157c2e refactor(theme/book): Split into modules (#556)
Advantages:
 - Easier to reason about
 - Can easily disable some modules when debugging
 - Shared dependencies are explicit (playpen_text)
 - Enables some fancier things later one (e.g. run `codeSnippets` slightly later, to avoid blocking the page)

I'm aware that `codeSnippets` should be split into the highlighter and the editor, but I'm not sure I understand exactly how they interact so I've left it as it is for now.
2018-01-21 23:01:57 +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 05a0d7e625 fix(theme/book): Disable stylesheets by property, not attribute
Closes #553.
2018-01-18 17:12:41 +01: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 b5382f49c6
Merge pull request #474 from stgn/sidebar-swipe
Basic swipe gesture functionality for opening/closing sidebar
2018-01-02 22:10:30 +08: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
Bartłomiej T. Listwon 8960013322 Fix copy to clipboard is available only for rust snippets
Fixes #432
2017-11-10 21:18:14 +01:00
Shane Nelson 6e4d2485c3 Basic swipe gesture functionality for opening/closing sidebar 2017-10-23 20:51:43 -04:00
Mathieu David a6d4881e00 Merge pull request #450 from Zengor/master
Call playground with /execute
2017-09-23 21:35:41 +02:00
steveklabnik 9b64db908f prefix sidebar too 2017-09-22 13:58:45 -04:00
Zengor 3823fc0e74 Call playground with /execute and not the legacy /evaluate.json
This commit changes the url used to call the playground, and the
request parameter format to go with it. The older evaluate is
available in the playground as a form of backwards compatibility
and swithcing now opens way for using newer features.
2017-09-21 00:24:47 -03:00
steveklabnik 793fb8f654 Change key for theme to not clobber old books
Fixes https://github.com/azerupi/mdBook/issues/448
2017-09-19 16:59:16 -04:00
Mathieu David 0d6adc5fc9 Fix the issue with pages named print not at the root 2017-09-13 22:17:23 +02:00
Michal Budzynski 6bc3039b4f Both static and ACE editable snippets have optional play button
- list of available crates is dynamically loaded from play.rust-lang.org
- play button is enabled only if crates used in snippet are available on playground
- ACE editor's play button is dynamically updated on each text change
- `no_run` is honored by always disabling the play button
- minor cleanups
2017-09-06 00:18:24 +02:00
Michal Budzynski cd90fdd407 first prototype of play-button enabling only if crate list supported
also minor refactor of clipboard handling
TODO:
- `no_run` support
- test with ACE
- disable play button with tooltip instead of hiding
2017-09-06 00:18:24 +02:00
Michal Budzynski c36eca15c2 renamed `Playpen` to `Playground` in ajax error handling 2017-08-06 17:10:52 +02:00
Michal Budzynski eed1a0a591 handle play.rust-lang.org communication errors in playpens
also add 15s communication timeout
2017-08-06 14:59:19 +02:00
projektir 16aa545c5b Integrating Ace #247 2017-08-03 22:45:33 -04:00
Michal Budzynski 672d91e6c2 Hide theme selector popup on interaction outside of it
Also set cursor to pointer on theme selector items.
2017-06-23 13:31:28 +02:00
Michal Budzynski c1c06d6dc1 Auto focus on content to allow keyboard navigation 2017-06-15 23:15:41 +02:00
Michal Budzynski a6275ebcdb copying to clipboard no longer copies the compilation results from "play" 2017-06-12 14:02:53 +02:00