Commit Graph

1087 Commits

Author SHA1 Message Date
joaofreires e2b0b05ef8
requested changes 2022-11-11 13:48:48 -03:00
joaofreires bcd63f97c5
Merge branch 'master' into add_absolute_links_support 2022-11-09 11:47:50 -03: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
joaofreires c1a0af3cf6
add absolute links support 2022-09-09 20:34:19 -03: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