Commit Graph

1152 Commits

Author SHA1 Message Date
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
Eric Huss 6dd785ea6c Update to highlight.js 11.0. 2021-07-26 12:40:28 -07:00
FWYongxing 49ef7b6f02 Don't highlight `inline code` blocks in headers with output.html.playpen(playgroud).editable=true 2021-07-27 01:02:17 +08:00
Eric Huss fae0759626 Split lang on tab to be consistent with rustdoc and GitHub. 2021-07-10 09:33:34 -07:00
Tuyen Pham cc74ca2e6e Update mod.rs 2021-07-10 09:26:41 -07:00
Tuyen Pham 7cae3a058d Support space as seperator between language and additional class in code block
This PR try to resolve this issue: https://github.com/rust-lang/mdBook/issues/1384
2021-07-10 09:26:41 -07:00
Eric Huss 8fb6ac7987
Merge pull request #1599 from notriddle/notriddle/play-button-no-output
feat(playground): show "No output" on playgrounds that print nothing
2021-07-08 13:17:15 -07:00
Michael Howell 82d32ee761 feat(playground): show "No output" on playgrounds that print nothing
Fixes #1594
2021-07-07 10:44:51 -07:00
Eric Huss 56652e8fa6
Merge pull request #1559 from joshrotenberg/title_ignore_flags_init
Add --title option and --gitignore flag to mdbook init
2021-07-06 09:22:38 -07:00
Eric Huss 96b6f02834
Merge pull request #1425 from alexmaco/completions
Add ability to generate shell completions via clap
2021-07-06 08:59:06 -07:00
josh rotenberg ebdab38a32 remove debugging 2021-07-04 20:25:04 -07:00
josh rotenberg b87c231fc3 first pass at 2021 support 2021-07-04 14:44:23 -07:00
josh rotenberg 8024b08f93 format 2021-07-04 12:00:13 -07:00
josh rotenberg 8ec0bf6e30 ignore now takes a value 2021-07-04 11:57:46 -07:00
josh rotenberg 86d390032b drop short flags 2021-07-04 08:15:51 -07:00
Eric Huss dc2062ab36
Merge pull request #1541 from ehuss/id-chapter_begin
Remove chapter_begin id from print output.
2021-06-08 14:55:06 -07:00
josh rotenberg b59aab56f2 Revert "book: use non_exhaustive attribute for struct Book"
This reverts commit c1b2bec7d7.
2021-06-08 12:46:27 -07:00
Eric Huss d325c601bb
Merge pull request #1554 from joshrotenberg/edit_url_custom_src
Use the configured book src directory for the edit url template path
2021-06-01 18:36:32 -07:00
josh rotenberg e5e10c681a add init flags
add init flags

update init command in guide
2021-05-31 20:47:51 -07:00
josh rotenberg 05edc4421b clippy: PathBuf to Path 2021-05-31 20:27:52 -07:00
Riccardo Magliocchetti 714c5fb81e renderer: remove redundant clone in CmdRenderer
As suggested by clippy:
https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone
2021-05-30 19:33:46 +02:00
Riccardo Magliocchetti 56ceb627b8 book: simplify is_draft_chapter
As suggested by clippy:
https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
2021-05-30 19:33:46 +02:00
Riccardo Magliocchetti c1b2bec7d7 book: use non_exhaustive attribute for struct Book
As suggested by clippy:
https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive
2021-05-30 19:33:46 +02:00
josh rotenberg fcf8f938d2 use panic::set_hook to exit 2021-05-28 07:40:56 -07:00
josh rotenberg 60aaa7ae31 use book_config.src for edit path
use book_config.src for edit path

use book_config.src for edit path

fmt

concat the path, this is a url
2021-05-27 21:54:58 -07:00
Eric Huss 3c2b8cd10f
Merge pull request #1539 from joshrotenberg/report_config_errors
Report book.toml parse error when invalid fields are found
2021-05-24 13:25:07 -07:00
josh rotenberg 6b0b42ebcc update build and rust config change 2021-05-24 12:01:56 -07:00
josh rotenberg 7a3513200f
Update src/config.rs
Co-authored-by: Eric Huss <eric@huss.org>
2021-05-24 11:59:32 -07:00
Eldred Habert 3ee22fb430
Apply max width to video as well as images
Since videos are essentially animated images, this same max width makes sense for both.
2021-05-23 16:10:26 +02:00
Eric Huss 16c5ec4d74 Remove chapter_begin id from print output. 2021-05-22 15:12:54 -07:00
Eric Huss 7e7e779ef7
Merge pull request #1526 from apatniv/add_log_messages
Add useful messages when command line preprocessor fails
2021-05-21 10:06:36 -07:00
Andrea Gelmini b364e8ea2c
Fix typos (#1540)
Signed-off-by: Andrea Gelmini <andrea.gelmini@gelma.net>
2021-05-21 12:56:32 +02:00
josh rotenberg 78325aaccb report book.toml parse errors
check config for book parse errors

add invalid_title_type

handle build and rust config errors
2021-05-19 09:32:24 -07:00
apatniv b21446898a Add useful messages when command line preprocessor fails 2021-05-08 12:48:57 -04:00
Eric Huss 84b3b7218e
Merge pull request #1437 from rust-lang-ja/summary-with-html-comments
Skip HTML nodes in SUMMARY.md
2021-05-04 07:26:03 -07:00
Eric Huss a72d6002b7
Merge pull request #1506 from flavio/feature/suggest-an-edit-link
Feature/suggest an edit link
2021-04-26 11:03:50 -07:00
Flavio Castelli 7525b35383
Rename git-repository-edit-url-template
Change the name of the git-repository-edit-url-template to be more
generic: `edit-url-template`

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
2021-04-26 09:59:08 +02:00
Guillaume Gomez c1d982d92b Remove duplicate "name" attribute on input 2021-04-24 17:27:49 +02:00
Flavio Castelli 7aff98a859
Fix generation of edit links
The `IndexPreprocessor` rewrites the path for files
named `README.md` to be `index.md`. This breaks the edit link
in some circumstances.

To address this issues, the `Chapter` struct has now a new attribute
called `source_path`. This is initialized with the same value as
`path`, but is never ever changed.

Finally, the edit link is built by using the `source_path` rather
than the `path`.
2021-04-19 18:58:15 +02:00
Jonas Berlin bbf54d7459
[ReviewFix] Replace edit baseurl with template and make visibility independent of git_repository_url. 2021-04-19 16:16:08 +02:00
Jonas Berlin dcc642e66d
[ReviewFix] cargo fmt 2021-04-19 14:51:16 +02:00
Jonas Berlin 2b738d4425
[ReviewFix] Fix variable naming 2021-04-19 14:51:16 +02:00
Jonas Berlin b3670ece0e
Add "Suggest an edit" link next to "Git repository"
Includes new configuration option `git-repository-edit-baseurl` for
supporting non-GitHub repository layouts.
2021-04-19 14:51:14 +02:00
Tatsuya Kawano 30ce7e79ac Skip HTML comments in the summary
- Revert changes in parse_numbered(). They were unnecessary.
2021-04-05 18:31:11 +08:00
David Tolnay 94f7578576
Add page title override: {{#title My Title}} (#1381)
* Add page title override: {{#title My Title}}

* Document {{#title}} in guide
2021-03-24 02:36:45 +01:00
Evian-Zhang 0eb23efd44 Make page-break not configurable 2021-03-16 09:33:19 +08:00
Evian-Zhang e78a8471c7 Add page-break option 2021-03-12 14:00:29 +08:00
Eric Huss c83bbd6319
Merge pull request #1463 from ehuss/fix-header-scroll
Fix some issues with fragment scrolling and linking.
2021-02-22 14:50:17 -08:00
Tim Small 7f59fdd9bd Enhance text contrast of `light` theme to improve accessibility.
The existing light theme has relatively low contrast between the text
(and other UI elements) and background (especially within code blocks).
This presents difficulties for people with reduced visual contrast
perception (common in older adults).

This patch makes changes to the default `light` theme to meet the
minimum contrast requirement of the v2.1 W3C WCAG (Web Content
Accessibility Guidelines)
https://www.w3.org/WAI/WCAG21/quickref/#contrast-minimum

The small size, and slender font used for the title text makes it hard
to read, even with the increased contrast colour scheme, so this patch
also increases the size of the title text font by 20%.

Closes #1442
2021-02-21 14:35:10 +00:00
Eric Huss 45d41eac5f Fix some issues with fragment scrolling and linking. 2021-02-12 16:37:07 -08:00
Eric Huss 1a0c296532
Merge pull request #1426 from ehuss/search-mark-words
Fix search highlighting with multiple words.
2021-01-14 17:01:52 -08:00
Eric Huss 9b4ab72a80
Merge pull request #1418 from ehuss/relative-renderer-command
Fix relative paths for renderer commands.
2021-01-14 17:01:41 -08:00
Eric Huss cdea0f6b61 Add missing parenthesis in doc comment. 2021-01-13 14:26:14 -08:00
pierwill e9b0be7090 Add intra-docs links to docs
Also fixes some punctuation and changes some wording.
2021-01-10 14:51:30 -08:00
Tatsuya Kawano d402a12e88 Skip HTML comments in the summary 2021-01-08 18:16:03 +08:00
Eric Huss 77e7cfd22b
Change `init --theme` to place theme in root. (#1432) 2021-01-07 01:29:38 +01:00
Eric Huss 09e7bb76dc
Remove mark from URL on escape. (#1427) 2021-01-05 19:31:16 +01:00
Eric Huss 28387130c0 Fix search highlighting with multiple words. 2021-01-04 14:20:36 -08:00
Eric Huss 33d3d9c3ec
Merge pull request #1389 from avitex/search-chapter-name
Add chapter name to search result breadcrumbs
2021-01-04 14:01:30 -08:00
Alexandru Macovei beec17e55d Add ability to generate shell completions via clap 2021-01-04 23:51:02 +02:00
Eric Huss e651f4d734
Merge pull request #1420 from apatniv/clippy_remove_clone
Clippy lint: Remove unnecessary clone
2021-01-04 11:33:37 -08:00
Eric Huss 87d2cd9845
Merge pull request #1421 from apatniv/clippy_use_single_char
clippy: use char instead of str
2021-01-04 11:31:06 -08:00
Pietro Albini 32abeef088 fix xss in the search page
Thanks to Kamil Vavra for responsibly disclosing the vulnerability
according to Rust's Security Policy.
2021-01-04 07:14:57 -08:00
apatniv 95e0743bc0 clippy: use char instead of str 2020-12-31 15:37:34 -05:00
apatniv 3c97525743 Clippy lint: Remove unnecessary clone 2020-12-31 15:18:37 -05:00
Eric Huss 9a65c8ab92 Fix relative paths for renderer commands. 2020-12-30 17:46:29 -08:00
francis-du fd4137a9ea fix: readerer get theme dir path bug 2020-12-28 09:20:23 -08:00
Vivek Bharath Akupatni a3d4febe3e
Provide useful feedback if user executes command in different folder (#1407)
Provides better feedback if user executes in a different folder than what is expected by mdbook

After the changes `mdbook build`
```
2020-12-19 14:27:35 [ERROR] (mdbook::utils): Error: Couldn't open SUMMARY.md in "/Users/vicky/rust/source_codes/mdbook_testing/src/src" directory
2020-12-19 14:27:35 [ERROR] (mdbook::utils):    Caused By: No such file or directory (os error 2)
```

Previously: `mdbook build`
```
2020-12-19 14:28:46 [ERROR] (mdbook::utils): Error: Couldn't open SUMMARY.md
2020-12-19 14:28:46 [ERROR] (mdbook::utils):    Caused By: No such file or directory (os error 2)
```
2020-12-27 12:45:11 -08:00
Eric Huss cf2459f730
Merge pull request #1393 from apatniv/fixing_error
Missing chapters Error Reporting: Add file name
2020-12-14 08:33:36 -08:00
Kousuke Takaki 6bcabcbb6b Improve error message 2020-12-14 16:11:01 +09:00
apatniv ef993e8cc2 Run rust formmater 2020-12-05 20:27:03 -05:00
apatniv a3a5386da0 Add more context regarding which missing file creation failed 2020-12-05 20:17:45 -05:00
avitex 942cc12a74
Add chapter name to search result breadcrumbs 2020-11-25 14:46:49 +11:00
Eric Huss 552e3378cf
Merge pull request #1378 from daynin/serialize-build-section
allow to serialize the "build" section
2020-11-12 10:41:12 -08:00
Sergey Golovin 7c0ddff96a allow to serialize the "build" section 2020-11-12 19:32:32 +03:00
Eric Huss 07e72757d3
Merge pull request #1376 from dtolnay/html
Escape `<` and `>` in rendered toc to match handlebars' escaping in <title>
2020-11-10 14:46:24 -08:00
Eric Huss 58f66a146d
Merge pull request #1375 from dtolnay/playground
Fix stray spacing after #playground code
2020-11-10 14:06:09 -08:00
Eric Huss 643d5ecc5c
Merge pull request #1285 from FrankHB/patch-1
Handled UTF-8 BOM
2020-11-10 14:02:01 -08:00
David Tolnay c712ba7aab
Escape <> in rendered toc 2020-11-08 22:26:30 -08:00
David Tolnay 1450070f73
Fix stray spacing after #playground code 2020-11-05 21:43:04 -08:00
FrankHB 9e9cf49c50 Added a test.
Signed-off-by: FrankHB <frankhb1989@gmail.com>
2020-10-07 22:50:25 +08:00
FrankHB 780fb979a0 Avoided the redundant allocation.
Signed-off-by: FrankHB <frankhb1989@gmail.com>
2020-09-29 18:01:06 +08:00
Camelid b77942d3c8
Rename `book-example` to `guide` (#1336)
`book-example` is a bit of a strange name given that it's not just an
example.
2020-09-23 03:16:09 +02:00
Eric Huss e6ac8ecdd9 Fix print icon. 2020-09-22 13:24:13 -07:00
Ross MacArthur e0b247e9d6 Add config option to disable print html, css, and icon 2020-09-22 11:40:02 -07:00
ifeanyi b349e8abc9 Fix windows typo 2020-09-09 17:57:45 +02:00
ifeanyi e225586953 Resolve full file paths when copying files
Currently, the `copy_files` function doesn't support symlink files due to
its use of `DirEntry::metadata` - To avoid this issue, this patch
resolves the file path first before checking for metadata.

Fixes #1157
2020-09-09 17:42:14 +02:00
Eric Huss 4df9ec90af
Merge pull request #1307 from camelid/prefer-bundled-scp
Prefer bundled version of Source Code Pro
2020-09-06 10:58:23 -07:00
Camelid 73cabeb904
Remove local version from `@font-face`
It's unlikely that the bundled version wouldn't load, and it's
especially unlikely that the page would load but the bundled version
would not.

Also, if it doesn't load, it should fall back to another monospace font,
which is fine.
2020-09-06 10:34:11 -07:00
Eric Huss 4b773024ae
Merge pull request #1309 from nerosnm/add-missing-space
Fix missing space before draft chapter titles
2020-09-06 09:40:55 -07:00
Eric Huss 33ea661350
Merge pull request #1310 from dtolnay/nojekyll
End .nojekyll file with newline
2020-09-06 09:21:59 -07:00