Commit Graph

1142 Commits

Author SHA1 Message Date
Aman Verma db092a404e State canonical URL using <link> not <meta>.
The Google SEO docs describe using the link element to specify the canonical
page in a redirect. They don't mention anything about <meta>.
2022-11-12 14:54:28 -06:00
Aman Verma edda3d1b51 Fix formatting of content attr in <meta http-equiv=refresh>
According to the HTML specification[1], there needs to be a space after the
semicolon and the URL must be unquoted.

[1]: https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-refresh
2022-11-12 14:47:21 -06:00
Aman Verma 27a11e7b35 Don't generate obsolete charset attrs in <script>.
According to the HTML specification[1], the charset attribute is obsolete in
script elements.

[1]: https://html.spec.whatwg.org/multipage/obsolete.html#HTMLScriptElement-partial
2022-11-12 14:45:09 -06:00
Aman Verma cfd4c93d88 Don't generate redundant <meta http-equiv=content-type>.
Quoting from the HTML specification[1]:

  A document must not contain both a meta element with an http-equiv attribute
  in the Encoding declaration state and a meta element with the charset
  attribute present.

So we remove the <meta> with the http-equiv attribute from our template.

[1]: https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-content-type
2022-11-12 14:27:52 -06:00
Will Crichton 852a882fab Improve error handling of extra-watch-dirs watching, fix not watching whitelisted files outside book root 2022-11-07 12:20:59 -08:00
Will Crichton fb0cbc90e3 Add support for watching additional directories 2022-10-28 11:47:33 -07:00
armandocumate 3fc036e01a fi xcopying invisible text 2022-10-14 16:53:59 -07:00
Brett Chalupa 79c159d123 Add styles for <kbd> elements
Allows for special styles to call them out since they're different than
normal text and different than code. They can make use of styles they
inherit for font style and weight.

Notes on changes:

- Added new CSS variables for reused elements
- The font-* rules are separate for each aspect so that they can inherit
  bold/italic/etc

Closes https://github.com/rust-lang/mdBook/issues/1813
2022-10-06 16:02:29 -04:00
Kian-Meng Ang cb01f11ad1 Fix typos
Found via `codespell -S ./src/theme -L crate,nam,varius,phasis`
2022-09-29 22:41:12 +08:00
David 75857fbf73
feat: use once_cell instead of lazy_static (#1894) 2022-09-22 15:05:39 -07:00
Martin Geisler 3958260353 Simplify the use of `Option::and_then`
I found a few places where `Option::and_then` could be simplified (in
my opinion) with `?` or with `match`.
2022-09-11 00:46:26 +02:00
Dylan DPC 66bf85b14f Require Rust 2021 edition
This allows us to clean up and simplify the code.
2022-09-09 16:00:35 +02:00
Guillaume Gomez 76b0493fb0 Remove unneeded type attribute for <script> 2022-08-29 21:07:50 +02:00
Chris Lovett 74eb4059d6
add a --chapter option to mdbook test. (#1741)
Sometimes when working on large books it is handy to be able to run mdbook on a single chapter of a book.
2022-08-25 19:13:51 -07:00
Eric Huss fff067b2a8
Merge pull request #1836 from mgeisler/trim-trailing-whitespace
Avoid empty last line in editable code blocks
2022-08-10 19:55:06 -07:00
Martin Geisler 217546c2a0 Trim trailing whitespace in Rust code blocks
Before, a code block would always end with a final newline. The
newline was added unconditionally by `hide_lines`.

When the code block is syntax highlighted by highlight.js, this is not
a problem, no empty line is added for a final trailing `\n` character.
However, when the code block is editable and thus handled by the ACE
editor, a trailing newline _is_ significant. I believe this issue is
most closely described by https://github.com/ajaxorg/ace/issues/2083
in the upstream repository.

The effect of the way ACE handles newlines is that a code block like

    <pre>
      Some code
    </pre>

will create an editor with _two_ lines, not just one.

By trimming trailing whitespace, we ensure that we don’t accidentally
create more lines in the ACE editor than necessary.
2022-08-10 03:11:08 +02:00
mitchmindtree 13035baeae Workaround rust nightly borrowcheck error (#1860)
Surprisingly, this fixes the error filed at #1860!

This seems suspicious, perhaps indicative of a bug in Rust's non-lexical
lifetime handling?

The lifetimes in the `handlebars::Renderable::render` method signature
are quite complicated, and its unclear to me whether or not Rust is
catching some new safety edge-case that wasn't previously handled
correctly...

Possibly related to `drop` order, which I *think* is related to the
order of binding statements?
2022-07-22 15:15:12 +10:00
Steven Engler 6a4ba95926 Fixed code padding in headings 2022-07-13 19:12:33 -04:00
Joseph Priou f92911b8aa
Revert "remove __non_exhaustive members, add non_exhaustive attribute instead" 2022-07-09 17:43:17 +02:00
Fauconfan 11781f0c1b remove __non_exhaustive members, add non_exhaustive attribute instead 2022-07-09 15:05:06 +02:00
Eric Huss 1d2b720ebe Always show the "serving on" info for `mdbook serve`. 2022-07-01 14:36:18 -07:00
ISSOtm 42129c6181 Always open index page with `serve --open` 2022-07-01 09:01:25 +02:00
ISSOtm fa5f32c7fd Make link to first chapter active in index page
Makes both pages more consistent, and also the previous test pass

Co-authored-by: Eric Huss <eric@huss.org>
2022-06-29 23:51:18 +02:00
ISSOtm 8571883923 Mark the first chapter as "index", even if not the first book item 2022-06-29 08:35:41 +02:00
Eric Huss 4cf005d4bd
Merge pull request #1832 from ISSOtm/clippy
Fix Clippy lints
2022-06-27 14:28:39 -07:00
Eric Huss b38792c166
Merge pull request #1833 from mattheww/2022-06_searchindex
Omit words longer than 80 characters from the search index
2022-06-27 14:17:40 -07:00
ISSOtm 248863addf Fix Clippy lints
Also remove `allow(clippy::*)`s where possible
2022-06-27 23:08:45 +02:00
Eric Huss cbf0ca027d
Merge pull request #1806 from ehuss/button-overlap
Make code buttons appear on hover (or tap on mobile)
2022-06-27 13:58:17 -07:00
Eric Huss 5f00625c14
Merge pull request #1617 from lf-/x-overflow
Fix some x overflows
2022-06-27 11:01:48 -07:00
Matthew Woodcraft 1f8c090a5f When creating the search index, omit words longer than 80 characters
This avoids creating deeply nested objects in searchindex.json
2022-06-26 12:22:52 +01:00
Dylan DPC a5f861bf2b
Revert "Omit words longer than 80 characters from the search index" 2022-06-22 13:31:16 +02:00
Eric Huss 2b903ad057 Make code block icons appear on hover. 2022-06-01 18:48:34 -07:00
Matthew Woodcraft d65ce55453 When creating the search index, omit words longer than 80 characters
This avoids creating deeply nested objects in searchindex.json
2022-05-22 14:00:20 +01:00
Eric Huss 37d756ae75 Adjust overlap of code buttons with code blocks. 2022-05-16 19:27:46 -07:00
Eric Huss f8782666ba
Merge pull request #1714 from joshrotenberg/draft-no-index
Check for the index.html file before trying to opener::open it
2022-05-16 08:04:38 -07:00
josh rotenberg c74c682939 call find_chapter when opening browser 2022-05-11 13:14:38 -07:00
josh rotenberg 8b49600673 call first_chapter 2022-05-10 11:19:23 -07:00
josh rotenberg 29c729fd23 call first_chapter 2022-05-10 11:17:20 -07:00
josh rotenberg 5d65967448 add first_chapter function 2022-05-10 11:16:22 -07:00
klensy af6237015a init regexes via lazy_static, don't recompute it 2022-05-06 10:05:52 +03:00
klensy f3332fb0da Use serde's `derive` feature instead of directly importing serde_derive 2022-05-05 09:33:51 +03:00
Clark a60571321a bail! in render() if specified theme directory does not exist 2022-04-26 20:20:44 +08:00
Eric Huss ceff050bb4 Don't try to render summary links as markdown. 2022-04-14 20:35:39 -07:00
josh rotenberg 860a17d85a
Merge branch 'rust-lang:master' into draft-no-index 2022-04-04 18:59:39 -07:00
Eric Huss 78bcda02cb Fix html print config default. 2022-03-30 07:58:27 -07:00
Eric Huss a5fddfa468
Merge pull request #1749 from tommilligan/unique-search-anchors
search: fix anchor ids for duplicate headers
2022-03-28 12:44:20 -07:00
Eric Huss 7c37dd5e85
Merge pull request #1731 from epage/clap3
Port mdBook to clap3
2022-03-28 12:34:17 -07:00
Ed Page 857ca19fe4 refactor: Move from deprecated arg_from_usage 2022-03-28 13:06:50 -05:00
Ed Page a19d91ef37 refactor: Move from deprecated multiple 2022-03-28 13:06:50 -05:00
Ed Page ac8526688a refactor: Move from deprecated empty_values 2022-03-28 13:06:50 -05:00
Ed Page 1e1c99bbdb refactor: Move from deprecated GlobalVersion 2022-03-28 13:06:50 -05:00
Ed Page 0c89293029 refactor: Move from deprecated ColoredHelp 2022-03-28 13:06:50 -05:00
Ed Page 39eb78c88b refactor: Move from deprecated SubCommand 2022-03-28 13:06:50 -05:00
Ed Page 372842aac6 refactor: Move from deprecated Arg::with_name 2022-03-28 13:06:50 -05:00
Ed Page 7934e06668 chore: Upgrade to clap3 2022-03-28 13:06:50 -05:00
Eric Huss 675c8c3f4e Add book title to 404 page title. 2022-03-27 17:17:20 -07:00
rsapkf 97cb77bbdd Add proper title to 404 page 2022-03-27 17:01:11 -07:00
Eric Huss 46345b8e49
Fix comment typo 2022-03-27 16:39:12 -07:00
Eric Huss 566451e9a7
Merge pull request #1771 from FWYongxing/master
livereload uses host, port and HTTP(S) protocol of current page
2022-03-27 16:33:32 -07:00
Eric Huss 15626294b0
Merge pull request #1744 from ilslv/1743-fix-title-consuming-events
Fix `SummaryParser::parse_title()` consuming events (#1743)
2022-03-27 14:38:00 -07:00
Shogo Takata 0dca4d9b9f
add tests 2022-03-26 15:34:07 +09:00
Shogo Takata b85c3035fe
Config to toggle the run button on codeblocks 2022-03-26 14:50:47 +09:00
Clark 6899d94027 livereload uses host&port of current page; livereload works with a HTTPS site 2022-03-19 04:38:16 +08:00
Tom Milligan 972c61fa76
search: fix anchor ids for duplicate headers 2022-02-18 16:20:05 +00:00
ilslv b73d02fb8c Remove colon to satisfy msrv 2022-02-11 12:50:22 +03:00
ilslv 6c4974b5c6 Fmt 2022-02-11 12:42:54 +03:00
ilslv 81d661c4f1 Fix no initial title consuming events. 2022-02-11 12:33:22 +03:00
Jade Lovelace 4ae7ab5e87 switch to break-word as suggested 2022-01-27 18:42:39 -08:00
Jade 59569984e2 Address review: use overflow-wrap everywhere 2022-01-27 18:41:31 -08:00
Jade 89b580ab52 Add a test for the table div-wrapping 2022-01-27 18:41:31 -08:00
Jade 85df785cd3 Wrap tables in an overflow-x wrapper div 2022-01-27 18:41:30 -08:00
Jade fde88c22a8 Fix an x overflow with long inline code
Spotted on
https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html
2022-01-27 18:39:09 -08:00
Daniel Morawetz 7b1241d0f2
Revert "Make page-break not configurable"
This reverts commit 0eb23efd44.
2022-01-17 18:03:52 +01:00
josh rotenberg 1cacef025d check for the index.html file first 2021-12-28 21:00:06 -08:00
Guillaume Gomez ddb0d2396f Update pulldown-cmark version 2021-12-25 13:46:27 +01:00
Eric Huss c9b6be8660
Merge pull request #1675 from ehuss/deprecate-ga
Deprecate google-analytics
2021-11-27 09:53:44 -08:00
Eric Huss 23af80c506
Merge pull request #1685 from igxactly/fix-ios-text-size-landscape
Prevent iOS Safari from enlarging text in landscape orientation
2021-11-20 10:01:41 -08:00
Eric Huss 857acb9759
Merge pull request #1683 from abdnh/strip-html-from-anchor-ids
Strip HTML tags from anchor IDs
2021-11-20 09:47:18 -08:00
josh rotenberg 1c0983b811 use pulldown cmarks curly quotes 2021-11-19 17:26:30 -08:00
josh rotenberg 1be69af553 need to actually enable it 2021-11-19 15:14:22 -08:00
Ingu Kang bbaa0ea1fa Prevent iOS Safari from enlarging text in landscape orientation
referernces:
  - https://developer.mozilla.org/en-US/docs/Web/CSS/text-size-adjust#basic_disabling_usage
  - https://trac.webkit.org/changeset/261940/webkit
2021-11-13 15:37:20 +09:00
Abdo 58bc92d380 Strip HTML tags from anchor IDs 2021-11-10 00:41:44 +03:00
Eric Huss c3ff4a5129 Deprecate google-analytics. 2021-10-24 11:43:37 -07:00
Eric Huss 4d20fa578b
Merge pull request #1642 from ehuss/stabilize-2021
Stabilize 2021 flag.
2021-10-24 10:30:55 -07:00
Eric Huss 0d887505af
Merge pull request #1607 from ISSOtm/preproc-order
Allow specifying preprocessor order
2021-10-03 14:22:15 -07:00
Ivan Tham e4a46c9477
Remove extra semicolon in variables.css 2021-10-03 22:23:09 +08:00
Ivan Tham 6ae5c686d9
Remove extra semicolon in variables.css 2021-10-03 22:19:51 +08:00
ISSOtm 6b790b83ec Warn when preproc order references unknown preprocs 2021-09-28 09:25:17 +02:00
ISSOtm d8ad68c947 Produce an error if `before` or `after` field is not a table 2021-09-27 21:28:21 +02:00
ISSOtm 6b784be616 Stabilize ties in preproc order through name sort 2021-09-27 21:28:01 +02:00
Johannes Stoelp ff4b8e7a8d switch from open to opener
By default, `opener` launches the subprocess without waiting for its
completion, compared to `open` which waits for its completion.

This is helpful in case the `watch` feature is enabled and one of the
following commands `watch | serve --open` is used. If this command would
open the browser, listening for changes would be blocked by the browser.
2021-09-26 12:33:09 -07:00
ISSOtm 9c34e602bd Allow specifying preprocessor order
Fixes #1172
2021-09-26 20:55:02 +02:00
Michael Howell 4251d7a838 Only switch to themes on buttons that have the `theme` class
Fixes #1649
2021-09-14 10:05:35 -07:00
apogeeoak 3f9f681b9e Update open crate to latest version. 2021-09-06 15:52:43 -04:00
Eric Huss 6be81214b1 Stabilize 2021 flag. 2021-09-03 11:00:27 -07:00
Eric Huss d22299d998
Merge pull request #1631 from benarmstead/master
Format better, remove unnecessary borrows, and update depends
2021-09-03 10:15:16 -07:00
Michael Howell 2a8af1c21d Include chapters with no headers in the search index 2021-08-31 12:48:21 -07:00
Ben Armstead 8a82f6336a Format with cargo correctly 2021-08-24 08:48:24 +01:00
Ben Armstead 1700783594 Format better and remove unnecessary borrows 2021-08-24 08:45:06 +01:00
Eric Huss 68d8ceec47 Revert #1597 - Update to highlight.js 11.0. 2021-08-02 08:02:13 -07:00