Commit Graph

65 Commits

Author SHA1 Message Date
Matt Ickstadt 69fef40e57 Improve print output (#680)
* Update print styles for new sidebar behavior

* Hide copy icons in print output

* Wait for mathjax rendering to complete before printing

* Remove old wrapping css
Browsers this old are already hilariously broken, so we don't need these fallbacks.

* Change mathjax script type
Chrome won't execute this if it's not marked as js

* Ensure page has rendered before printing
In certain situations Chrome willl fire window.onLoad before it's
done rendering. Add a 100ms delay to work around this.
2018-05-01 20:29:34 +08:00
Michael Bryan 41399fc29c
Revert "Fixes the search box overlapping with content when first shown (#666)" (#667)
This reverts commit 7f82a197b9.
2018-04-11 10:23:56 +08:00
Michael Bryan 7f82a197b9
Fixes the search box overlapping with content when first shown (#666) 2018-04-10 22:02:27 +08: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
Guillaume Gomez cc92d665ca Improve css so anchor don't go under sidebar (#638) 2018-03-14 23:23:55 +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 89a5dbaf9a fix(theme/stylus/sidebar): Contain scrolling to the sidebar (#612)
> A position fixed left navigation bar does not want to hand off scrolling to the document because a scroll gesture performed on the navigation bar is almost never meant to scroll the document. In this case, the author can use contain on the sidebar to prevent scrolling from being chained to the parent document element.

https://wicg.github.io/overscroll-behavior/#motivating-examples
2018-02-15 07:24:39 +08:00
Sorin Davidoi 07551760c9 feat(theme/stylus/sidebar): Reduce padding on non-touch devices (#615)
Closes #594.
2018-02-15 06:59:55 +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
boxdot 43fcd00cd5 Inline footnotes. (#600) 2018-02-02 20:15:48 +08:00
Michael Bryan 50ee15472b
Updated the light theme to have a lighter scrollbar (#590) 2018-01-27 11:52:43 +08:00
Sorin Davidoi 186e649530 feat(src/theme): Scrollbar theme (#563) 2018-01-26 01:17:02 +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 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 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
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 a2759b7bd2 Prevent horizontal scroll on mobile browsers if page wrapper is pushed off-screen 2017-12-17 23:04:30 -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
Shane Nelson 6e90e520d6 Avoid resizing page/content on sidebar toggle 2017-12-17 23:04:30 -05:00
lifta42 9143110a43 Optimized the stylesheet for better performance 2017-12-06 16:20:22 +08:00
Shane Nelson dd3bef8000 Use absolute positioning for theme popup 2017-10-16 21:40:32 -04:00
Bartłomiej T. Listwon 911683d2cf Fix styling regression on print media in chromium
Forces 0px left padding on print view even if sidebar is visible
2017-09-18 22:10:31 +02:00
Bartłomiej T. Listwon 91fd8a2865 Fix code snippet font size a little smaller in FF 2017-09-18 11:18:21 +02: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 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
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
Jimmy Do bd9b0d29ea On iOS, allow scrolling to the top of the page by tapping the top of the screen
* This is a built-in function of iOS Safari that didn't work because the
  page content was inside absolutely-positioned, scrollable divs.

* The fix is to stop using absolute positioning on `.page-wrapper` and
  `.page`, so that the content uses static positioning and flows
  naturally down the page.

* Consequently, `.sidebar` and `.nav-chapter` now have to use `position:
  fixed` in order to be positioned relative to the viewport.

* This fix also enables Safari's built-in behavior of automatically
  hiding the top and bottom toolbars when scrolling down the page.
2017-06-18 09:58:52 -07:00
Michal Budzynski c1c06d6dc1 Auto focus on content to allow keyboard navigation 2017-06-15 23:15:41 +02:00
Michal Budzynski ee9fa8c86f Fix for playpen buttons missing on mobile safari and chrome IOS 2017-06-13 16:59:29 +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
Michal Budzynski dfc24bec01 Fixed tooltip styling
Also fixed problem with garbage being put in clipboard
when triggered repeatedly
2017-05-31 21:07:47 +02:00
Michal Budzynski e567d22f1c Initial implementation of clipboard handling 2017-05-31 19:56:17 +02:00
aaaxx cc1cb9edb0 CSS: better fallback stack for monospaced fonts
List of system fonts (R, I, B means roman, italic and bold. Ubuntu probably comes with more fonts, but I couldn't find a list to confirm.):

```txt
Windows
----------
Consolas            R RI  B BI
Courier             R
Courier New         R RI  B BI
Lucida Console      R

Mac
----------
Andale Mono         R
Courier             R RI  B BI
Courier New         R RI  B BI
Menlo               R RI  B BI
Monaco              R

Ubuntu
----------
Ubuntu Mono         R RI  B BI
DejaVu Sans Mono    R RI  B BI
```

```css
font-family: Consolas, "Ubuntu Mono", Menlo, "DejaVu Sans Mono", monospace, monospace;
```

Consolas and Ubuntu are professionally designed fonts ([Lucas de Groot][1] and [Dalton Maag][2]), with true, calligraphic italic, so they go at the top of the stack.

Menlo is [based on DejaVu Sans Mono][3], the only difference being a few tweaked glyphs, so DejaVu serves as a fallback for it.

As for Courier New, other than being unreadably spindly, it's the default monospaced font in all browsers, so there's no need to include it in the stack.

The `monospace, monospace;` declaration is, by now, [a standard hack][4] that overrides some browsers' behaviour of defaulting the `monospace` elements to smaller font size. Without it, any relative font size you apply to them will be calculated from that reduced size (seems to be 13 px in all browsers).


[1]: https://en.wikipedia.org/wiki/Luc(as)_de_Groot
[2]: https://en.wikipedia.org/wiki/Dalton_Maag
[3]: http://www.leancrew.com/all-this/2009/10/the-compleat-menlovera-sans-comparison/
[4]: https://stackoverflow.com/questions/38781089/font-family-monospace-monospace
2017-05-24 06:07:58 +02:00
Michal Budzynski 9c8c819ec3 Inline code with hyperlink is now highlighted
Inline code with hyperlink has now a different color then
standard inline code and has a on hover underline.
2017-05-20 17:10:53 +02:00
Vincent Esche 41735b4579 Added monospace font with support for box-drawing chars 2017-04-15 14:16:28 +02:00
Mathieu David 4852e9e65a Merge branch 'master' of https://github.com/azerupi/mdBook 2016-09-12 22:50:03 +02:00
Mathieu David e54b6643e1 regenerate css 2016-09-12 22:43:29 +02:00
Mathieu David c7a95ccb8b Fix round corners in theme selector, changes were previously comitted directly to the css file causing them to be overwritten 2016-09-12 22:19:36 +02:00
Mathieu David 81a8f946b7 Fix print.styl, changes were previously comitted directly to the css file causing them to be overwritten 2016-09-12 22:10:33 +02:00
Boris Egorov 49608b560b Make line-height for chapter greater than section
Fixes #166
2016-09-04 22:04:55 +07:00
Mathieu David 5891e4b5db Fix bug where theme-popup was under the navigation arrows making it impossible to change the theme 2016-02-16 08:50:57 +01:00
Mathieu David 7364d41f0c Style tables, different header bg, alternate row color and border 2016-02-05 18:09:35 +01:00
Mathieu David 0b00c270d5 Fix a style bug caused by the insertion of the theme-popup div inside font awesome icon <i>
The div is now inserted after the <i>, the text color has also been changed to the foreground color and the "(default)" text that indicates the default theme is now grey to contrast with the theme name

Fixes #97
2016-02-03 17:55:19 +01:00
Mathieu David 78b6148463 Basic formatting for tables + Styling for blockquotes
Added basic formatting for tables so that they have some padding and are aligned in the center of the page.
I did not add color or borders because I am not sure how tables should look like.

A lot of people in IntermezzOS want asides, blockquotes are probably the easiest way to do that. I have thus styled blockquotes for all the color themes.
2016-01-03 13:47:59 +01:00
Mathieu David 5170e6b675 Fix #89, bug introduced earlier where all headers are black in all color themes 2016-01-01 11:02:24 +01:00
Mathieu David a7f329d337 Add href to heading anchors so that the url for the anchor is displayed in the url bar when clicking the header 2016-01-01 02:17:40 +01:00
Mathieu David db7424e947 Continue #29, playpens are now runnable 2016-01-01 00:32:12 +01:00