Commit graph

1185 commits

Author SHA1 Message Date
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
Eric Huss
1b18740b56
Merge pull request #1311 from dtolnay/cname
Support emitting CNAME file for publishing at a custom domain
2020-09-06 09:21:29 -07:00
Eric Huss
fd59dc73e5
Adjust wording 2020-09-06 09:11:53 -07:00
Gus Wynn
5ea8e55aea collect all test failures before failing 2020-09-03 18:36:51 -07:00
David Tolnay
1acf23ff73
Support emitting CNAME file for publishing at a custom domain 2020-09-02 11:24:48 -07:00
David Tolnay
69cc1fa005
End .nojekyll file with newline
Before:

    /path/to$  cat book/.nojekyll
    This file makes sure that Github Pages doesn't process mdBook's output./path/to$  ▎

After:

    /path/to$  cat book/.nojekyll
    This file makes sure that Github Pages doesn't process mdBook's output.
    /path/to$  ▎
2020-09-02 11:06:19 -07:00
Søren Mortensen
2fb489137b
Wrap draft chapter titles in a <div>
Fixes the problem of a missing space before the title of draft chapters,
due to the title not being wrapped in an `<a></a>`.
2020-08-31 10:00:03 +01:00
Camelid
4d9eb9b4b4 Prefer bundled version of Source Code Pro
This prevents an issue with Firefox 80 on macOS that prevents syntax
highlighting from working.
2020-08-29 13:22:51 -07:00
Eric Huss
3d44553671
Merge pull request #1293 from Evian-Zhang/master
allow space in SUMMARY.md's link destination
2020-08-08 08:19:06 -07:00
Evian-Zhang
9d5c454e47 delete '+' replacement and use cargo fmt to format 2020-08-08 15:13:22 +08:00
Eric Huss
a00e7d1769
Merge pull request #1272 from ehuss/fix-favicon-link
Fix favicon when only one is overridden.
2020-08-07 08:34:46 -07:00
Evian-Zhang
60be20a783 allow space in SUMMARY.md's link destination 2020-08-03 09:49:01 +08:00
Eric Huss
8746206060
Merge pull request #1284 from ericonr/opt
Mention that uninstalled backend isn't marked optional.
2020-07-30 20:22:55 -07:00
Érico Rolim
dcf9462d1e summary: turn SoftBreak events into spaces.
Summary items that had their name split into two lines ended up with the
last word of one line and the first word of the next line glued
together, since a space wasn't added.

Added test case for it.

Fixes #1218
2020-07-29 15:53:27 -03:00
Érico Rolim
78aa2a16f8 Mention that uninstalled backend isn't marked optional.
If an uninstalled backend (command not found) isn't marked optional,
warn about it, since it causes mdbook commands to error out.

Fixes #1283
2020-07-28 18:08:32 -03:00
FrankHB
65d9eb6f7e
Handled UTF-8 BOM
Fixed #1155 .
2020-07-25 13:02:44 +08:00
Eric Huss
303db0ddec
Merge pull request #1277 from maniyar1/patch-1
Update highlight.js
2020-07-21 14:17:03 -07:00
maniyar1
60029e4e15
Add R-lang support 2020-07-20 19:03:29 -04:00
Owen Nelson
0eefd63a13 Change "show hidden lines" icon to "eye" instead of "expand."
In a recent discussion in the amethyst docs discord channel,
it was suggested that using an "eye" icon might make the show hidden
lines feature of mdbook's code sample rendering more discoverable.

I myself overlooked the arrows that are in use now.

Fixes #663 at least in part.
2020-07-16 19:27:18 -07:00
maniyar1
c99047bbda
Update highlight.js
Updates to 10.1.1, with support for new languages added to the common set.
Built with:
common languages + D, handlebars, haskell, julia, scala, x86asm, armasm, yaml
Size difference:
New highlight.js: 132KiB
Old highlight.js: 84KiB
--
New highlight.js compressed: 48KiB
Old highlight.js compressed: 36KiB
2020-07-09 14:01:51 -04:00
Eric Huss
20a0b99c3d Fix favicon when only one is overridden.
A mistake in #1266, I neglected to also update the <link> generation
to elide the link if one of the favicon images is not included.
2020-07-08 12:44:07 -07:00
Eric Huss
649f3555e5
Merge pull request #1266 from ehuss/favicon-no-default
Don't copy default favicon if at least one is overridden.
2020-07-03 08:47:34 -07:00
Eric Huss
b0c6f2d7a3 Don't copy default favicon if at least one is overridden. 2020-06-27 16:30:46 -07:00
Eric Huss
e9951af73e Fix sidebar scrolling with part titles. 2020-06-24 21:13:02 -07:00
Eric Huss
4699269e49 Add SVG favicon. 2020-06-23 10:58:10 -07:00
Eric Huss
f59cfe7e2f Fix dest-dir command-line flag. 2020-06-23 10:55:01 -07:00
Eric Huss
9268884b17
Merge pull request #1221 from manuel-woelker/fb-539-not-found-page
Generate 404.html page (#539)
2020-06-23 10:48:08 -07:00
Eric Huss
4f435c62e6
Merge pull request #1249 from ThePuzzlemaker/thepuzzlemaker-stylepatch
Fix issue where Font Awesome overrides `.hidden`'s `display: none`
2020-06-22 12:28:09 -07:00
Eric Huss
9a97f0a096
Fix init creating empty [rust] table. (#1233) 2020-06-22 16:36:37 +02:00
Eric Huss
bc23d08fa5
Rename playpen to playground. (#1241)
looks good
2020-06-22 16:34:25 +02:00
ThePuzzlemaker
84d848f292
Fix issue where Font Awesome overrides .hidden's display: none 2020-06-10 12:55:22 -05:00
Manuel Woelker
d7df832cce fix test and formatting 2020-06-10 15:33:09 +02:00
Manuel Woelker
406b325c54 fix usage of newly stablized inner_deref/as_deref 2020-06-10 13:09:18 +02:00
Manuel Woelker
06efa7a675 additional changes to the 404 mechanism based on feedback:
- removed config output_404
 - ensure serve overrides the site url, and hosts the correct 404 file
 - refactor 404 rendering into separate fn
 - formatting
2020-06-10 12:46:23 +02:00
Manuel Woelker
bff36e7229 Add the config parameter output.html.site-url to set base url of the 404 page, making links and relative script/css loads behave correctly even in subdirectory paths 2020-06-10 12:46:23 +02:00
Manuel Woelker
cda28bb618 Generate 404.html page (#539) 2020-06-10 12:46:23 +02:00
Eric Huss
23f5ffd6d6 Change default preferred-dark-theme to navy. 2020-06-08 11:40:38 -07:00
Bryce Fisher-Fleig
fb1476d1e3
fix: don't jump away from form input to search bar
Addresses #1020 with the suggestion from prior PR #1101
2020-06-04 14:35:49 -07:00
Michael-F-Bryan
da55cf273f
Changed redirect mapping to HashMap<String, String> and improved error handling 2020-05-27 03:12:57 +08:00
Michael-F-Bryan
b2d50392ea
Emit redirects towards the end of the rendering process 2020-05-27 02:42:56 +08:00
Michael-F-Bryan
a5086a1e58
Added a redirect map to the HTML config 2020-05-27 02:38:04 +08:00
Eric Huss
6c4c3448e3
Update dependencies. (#1211)
* Removed the itertools dependency

* Removed an unused feature flag

* Stubbed out a toml_query replacement

* Update dependencies.

* Bump env_logger.

* Use warp instead of iron for http server.

Iron does not appear to be maintained anymore. warp/hyper seems to be
reasonably maintained. Unfortunately this takes a few seconds more
to compile, but shouldn't be too bad.

One benefit is that there is no longer a need for a separate websocket
port, which makes it easier to run multiple servers at once.

* Update pulldown-cmark to 0.7

* Switch from error-chain to anyhow.

* Bump MSRV to 1.39.

* Update elasticlunr-rs.

Co-authored-by: Michael Bryan <michaelfbryan@gmail.com>
2020-05-20 23:32:00 +02:00
Eric Huss
5d5c55e619
Merge pull request #1171 from mark-i-m/master
implement support for book parts
2020-05-20 12:17:45 -07:00
Eric Huss
e677b72eb8
Merge pull request #1188 from pheki/remove-google-surveillance
Remove google fonts by serving them locally
2020-05-20 11:01:07 -07:00
Aphek
7e090ca42f Also copy font licenses when copy-fonts is enabled 2020-05-19 03:17:01 -03:00
Aphek
122c988477 Rename config from no-copy-fonts to copy-fonts 2020-05-19 03:09:25 -03:00
mark
d0fe9bd41c make part titles another SummaryItem 2020-05-18 11:18:14 -05:00
mark
91e3aa4b55 try to satisfy msrv? 2020-05-17 16:53:06 -05:00
mark
2d63286c63 make part titles bold 2020-05-17 16:53:06 -05:00
mark
5dd2a5bff4 implement support for book parts 2020-05-17 16:53:06 -05:00
Eric Huss
1b3b10d2ae
Do not allow the sidebar to be dragged outside the window. (#1229) 2020-05-17 22:05:12 +02:00
Aphek
2c26c65f4d Remove google fonts by serving them locally
Co-authored-by: Aral Balkan <aral@ind.ie>
Co-authored-by: Collyn O'Kane <47607823+okaneco@users.noreply.github.com>
2020-05-15 02:48:28 -03:00
Eric Huss
6038af292f Remove some unnecessary blocks. 2020-05-10 09:23:40 -07:00
Mathieu David
43008ef2ef fix issues from code review 2020-05-10 09:04:02 -07:00
Mathieu David
d605938886 Bring back draft chapters 2020-05-10 09:04:02 -07:00
Gilles Rasigade
c2d58158da Revert HTML auto-formatting 2020-05-10 08:42:53 -07:00
Gilles Rasigade
61c8413138 Allow to define own HTML <head> attributes
Create a `index.hbs` template file to render additional HTML <head> attributes
2020-05-10 08:42:53 -07:00
Eric Huss
8ee950e3de
Merge pull request #1214 from ehuss/fix-clippy
Fix some clippy warnings.
2020-05-10 08:39:19 -07:00
Eric Huss
c44ef1b2f0 Fix some clippy warnings. 2020-05-10 08:29:50 -07:00
Eric Huss
07dfc4b89a
Merge pull request #1207 from toyboot4e/fix-mdbook_book
Enable `MDBOOK_BOOK`  to overwrite `book.toml`
2020-05-08 06:51:21 -07:00
toyboot4e
282e55122e
Update src/config.rs
Co-authored-by: Eric Huss <eric@huss.org>
2020-05-08 19:56:41 +09:00
Tomasz Kurcz
b1cf3f117d Links preprocessor: support pluses in file paths 2020-05-03 14:50:03 +02:00
Tomasz Kurcz
d665732056 Links preprocessor: test links with special characters 2020-05-03 14:42:22 +02:00
toyboot4e
2f59dbf1ef Fix example of MDBOOK_BOOK (again) 2020-05-03 18:58:41 +09:00
toyboot4e
3a63276727 Not to use matches! 2020-05-03 18:16:44 +09:00
toyboot4e
4c64f23089 Fix example of MDBOOK_BOOK 2020-05-03 17:54:35 +09:00
toyboot4e
683d2b2240 Fix use of MDBOOK_BOOK 2020-05-03 17:54:17 +09:00
Eric Huss
2732c5e8f7 Update docs and tweak error messages. 2020-04-21 15:34:59 -07:00
Kim Hermansson
6b550cb4bb Make missing backends optional. 2020-04-21 15:13:14 -07:00
Eric Huss
28ce8f5ac0 Some edition cleanup and fixes. 2020-04-21 12:26:48 -07:00
kngwyu
255756cfee Make new [rust] config and move edition config under it 2020-04-21 10:24:47 -07:00
Gabriel Majeri
53d821bf6d Add edition to hbs renderer 2020-04-21 10:24:47 -07:00
Gabriel Majeri
d39d4517aa Add support for Rust edition 2020-04-21 10:24:47 -07:00
Mike English
1d265fd143 Broaden scope of suppressed warnings for listings without a main fn
At present, code listings without a main function will be wrapped in one and
annotated with an allow lint check attribute provided by the following [code][]:

```
format!(
    "\n# #![allow(unused_variables)]\n{}#fn main() {{\n{}#}}",
    attrs, code
)
```

A broader lint check attribute such as `#![allow(unused)]` seems like it might
better fit the apparent intent of this code.

Addresses: https://github.com/rust-lang/mdBook/issues/1192

[code]: 769cc0a7c1/src/renderer/html_handlebars/hbs_renderer.rs (L635-L638)
2020-04-18 01:36:11 -04:00
Eric Huss
99ecd4f87c
Merge pull request #1170 from ehuss/fix-theme-focus
Fix theme selector focus.
2020-04-03 12:45:33 -07:00
Eric Huss
e839ef0866
Fix sidebar line-height. (#1182) 2020-04-03 21:09:23 +02:00
Andrew Mackenzie
c2686a817a Address PR review comments 2020-04-03 10:39:15 -07:00
Andrew Mackenzie
bd14d0910a Avoid a possible recursive copy when destination (build_dir) is underneath source directory. Update docs to match. 2020-04-03 10:39:15 -07:00
Eric Huss
6eb597a556
Revert "Assure copy_files_except_ext(..) won't copy directories into itself (#1135)" (#1181)
This reverts commit d7a2b29f06.
2020-04-03 19:12:43 +02:00
Dylan DPC
59568208ff
Revert "Support anchors in SUMMARY (#1173)" (#1175)
This reverts commit 2baed040c2.
2020-03-24 23:52:24 +01:00
Eric Huss
21a16c9b75
Scroll sidebar to middle instead of top. (#1161)
* Fix: Scroll sidebar to current active section (#1067)

* Clean: Some code related to PR #1052

* Change `scrollIntoViewIfNeeded` with `scrollIntoView`

* Don't use onload event for sidebar scroll to reduce flickering.

Co-authored-by: 李鸿章 <poodll@163.com>
2020-03-24 21:08:53 +01:00
Eric Huss
4e8e1e1408
Don't highlight code spans in headers. (#1162) 2020-03-24 20:43:20 +01:00
Martin Carton
2baed040c2
Support anchors in SUMMARY (#1173)
* Parse anchors in `SUMMARY.md`

* Support sub-links in SUMMARY with html renderer

* Add some tests for anchors
2020-03-24 19:15:28 +01:00
Eric Huss
f7ffffbd1e Fix theme selector focus. 2020-03-20 11:12:42 -07:00
dalance
b82562fe8a Fix SUMMARY's parse_numbered with comment 2020-03-18 12:28:27 +09:00
Eric Huss
44c3213f5d
Merge pull request #1130 from sunng87/feature/handlebars-3.0
Update handlebars to 3.0
2020-03-08 18:54:39 -07:00
Dylan DPC
fd56a53e76
ui: improve menu folding (#989)
* ui: improve menu folding

Fold/unfold the menu bar just by the amount of scroll, not by its
full width

* refactor: use a variable for the menu bar height

* Fix menu scroll jittering, remove hover folding smoothness

Rewrite it to use `position:` `sticky` and `relative` instead
of continuous programmatic position changes

On-hover folding-unfolding transition removal is a side-effect
2020-03-06 01:11:37 +01:00
Dylan DPC
ca4b85b815
Increases line height for p, ul & ol (#1136) 2020-03-06 01:06:19 +01:00
Sebastian Thiel
d7a2b29f06
Assure copy_files_except_ext(..) won't copy directories into itself (#1135)
This prevents recursive copy-loops when the destination directory
is contained in the source directory.

Now it bails out with a descriptive error message.
2020-02-29 19:20:55 +01:00
Evan Carroll
2bd8bdf798 Support rel=next and rel=previous
This resolves GH #1149
2020-02-18 09:20:17 -06:00
Sergey Pedan
0da7ba4abe
Corrects inner/outer space in sidebar <li>s (#1137) 2020-02-17 22:04:59 +01:00
Tomasz Różański
95fba3f357 Add a case for an empty book_title parameter
Html page title for every chapter in the book is created by the following code:
```rust
let title: String;
{
	let book_title = ctx
	.data
	.get("book_title")
	.and_then(serde_json::Value::as_str)
	.unwrap_or("");

	title = ch.name.clone() + " - " + book_title;
}
```

If the `book.toml` file is missing, and `book_title` parameter is empty, there's an awkward ` - ` string hanging at the end of each chapter's title.

This PR adds a `match` case to handle that kind of situation.
2020-02-15 23:13:37 +01:00
Avery Harnish
b8fc7a1b2d fix: ayu theme meta highlighting 2020-01-30 09:57:45 -06:00
Ning Sun
1947f8ca65
Update handlebars to 3.0 2020-01-24 11:01:44 +08:00
Eric Huss
2f59943c04 rustfmt with 1.40
Some slight changes in formatting in 1.40.
2019-12-31 16:23:25 -08:00
Arashmidos
6a94492238 fix scroll issue (#1108)
* fix sidebar scrolling

* fix query selector
2019-12-02 11:07:24 +01:00
nickelc
49b7f08164 Fix doc comment of BuildConfig::create_missing (#1104) 2019-11-29 06:22:21 +01:00
Eric Huss
7def6d70e8
Merge pull request #1099 from Michael-F-Bryan/expose-execute-build-process
Exposed the MDBook::execute_build_process() method to 3rd parties
2019-11-23 10:44:58 -08:00
Michael Bryan
730d7f8410
Exposed the execute_build_process() method to 3rd parties 2019-11-17 20:59:55 +08:00
Dylan Owen
b6603468d6 Stop scrolling on socket reload 2019-11-12 18:06:11 -08:00
Marcus Klaas de Vries
2a3088422a Upgrade pulldown_cmark to 0.6.1 2019-11-11 20:25:38 +01:00
Dylan DPC
1f505c2b2e
Revert "Add support for Rust edition 2018 in playpens (#1086)" (#1093)
This reverts commit a7b3aa0444.
2019-11-11 13:24:13 +01:00
Gabriel Majeri
a7b3aa0444 Add support for Rust edition 2018 in playpens (#1086)
* Add support for Rust edition 2018 in playpens

* Add Rust edition support to rustdoc

* Run rustfmt

* Fix enum variant reference
2019-11-11 12:42:24 +01:00
Eric Huss
a9160acd64
Merge pull request #1088 from benediktwerner/master
Fix hiding of empty boring lines
2019-11-07 07:44:47 -08:00
Benedikt Werner
4c1bca1684
Don't hide macro lines 2019-11-07 02:42:02 +01:00
Benedikt Werner
8fffb2a704
Hide lines in ignored code blocks 2019-11-07 02:20:10 +01:00
Ricky
3ea0f9b745 Lowercase matching the theme name (#1079)
* Using .to_lowercase() on the theme matching to avoid needed exact capitolization in the book.toml

* Changed the default-dark-theme from .to_string() to .to_lowercase() to match theme
2019-11-05 13:55:08 +01:00
Benedikt Werner
f5549f2267
Hide empty lines starting with '#' in playpens 2019-11-04 14:03:25 +01:00
Benedikt Werner
e2a8600712
Remove outdated unused var in theme js code 2019-11-04 14:03:24 +01:00
Steve Klabnik
f79d5d4582 rust-lang-nursery -> rust-lang
Fixes #1080
2019-10-29 08:04:16 -05:00
Rostislav
820714a560 Use only relative font sizes (#894)
This replaces the only use of px for font-sizes by setting up a base
rem size on the root element in a way that is easy to calculate (1 rem =
10px) and scaling up according to browser settings.
2019-10-27 15:51:32 +01:00
Matthew Woodcraft
86a368b726 Introduce a --menu-bar-height CSS variable 2019-10-26 13:21:26 +01:00
Matthew Woodcraft
1dc482b00d Add scroll-margin-top to headings which contain link targets.
This means when the link is followed, the page scrolls in such a way as to
leave space for the fixed menu bar.

Fixes #1040
2019-10-26 12:55:12 +01:00
Eric Huss
21d8f394ae Fix "next chapter" spacer handling. (#1075) 2019-10-25 17:33:21 +02:00
Benedikt Werner
c9dae170f3 Better automatic dark mode (#1069)
* Don't save default theme to localStorage

* Auto enable dark mode on no-js

* Fix light theme with no-js
2019-10-23 12:15:59 +02:00
rnitta
a592da33bb fix the behavior of sticky header (#1070) 2019-10-19 10:07:41 +02:00
Weihang Lo
6af6219e5b [Feature] expandable sidebar sections (ToC collapse) (#1027)
* render(toc): render expandable toc toggle

* ui(toc): js/css logic to toggle toc

* test: update rendered output css selector

* config: add `html.fold.[enable|level]`

* renderer: fold according to configs

* doc: add `output.html.fold`

* refactor: tidy fold config

- Derive default for `Fold`.
- Use `is_empty` instead of checking the length of chapters.
2019-10-19 09:56:08 +02:00
Andrew Pritchard
e5f74b6c86 Option to display copy buttons. (#1050)
* Option to display copy buttons.

- Added field to playpen data structure
- Communicate through window.playpen_copyable
- Javascript updated to check before displaying copy buttons.

* html -> html_config

Also:
- update description of copyable in source code.
- update description of line_numbers (my last PR to this repository)
2019-10-17 12:44:54 +02:00
Benedikt Werner
84a2ab0dba Reapply: Move hiding of boring lines into static content (#846) (#1065)
* Move hiding of boring lines into static content (#846)

* Fix test for hidden code
2019-10-16 11:27:14 +02:00
David Omar Flores Chávez
d63ef8330d Add !important to code {font-family} property (#1062)
If accepted, this will fix #1061
2019-10-11 14:21:13 +02:00
rnitta
01e50303a2 add a command to playpen (#1066) 2019-10-11 14:16:06 +02:00
Dylan DPC
2b3304cb8b
Revert "Move hiding of boring lines into static content (#846)" (#1064)
This reverts commit 4448f3fc4b.
2019-10-10 14:31:55 +02:00
Adrian Heine né Lang
4448f3fc4b Move hiding of boring lines into static content (#846) 2019-10-10 13:55:29 +02:00
Chris Ladd
859659f197 Fix inline code display css (#1058) 2019-10-07 09:24:35 +02:00
Eric Huss
4a93eddae2 Fix "next" navigation on index.html (take 2). (#1005) 2019-10-06 17:55:36 +02:00
Eric Huss
0173451b67 Fix error message for missing output.html. (#1056) 2019-10-06 00:33:50 +02:00
Carol (Nichols || Goulding)
ac1749ff2f Implement a rustdoc_include preprocessor (#1003)
* Allow underscores in the link type name

* Add some tests for include anchors

* Include parts of Rust files and hide the rest

Fixes #618.

* Increase min supported Rust version to 1.35

* Add a test for a behavior of rustdoc_include I want to depend on

At first I thought this was a bug, but then I looked at some use cases
we have in TRPL and decided this was a feature that I'd like to use.
2019-10-06 00:27:03 +02:00
Eric Huss
8cdeb121c5
Merge pull request #1055 from amanjeev/amanjeev/clean-command
Fix (command:clean): removes error message 'dir not found' if 'clean' is run multiple times
2019-10-05 14:03:31 -07:00
Amanjeev Sethi
74313bb701 Fix (command:clean): removes error message 'dir not found' if 'clean' is run multiple times (uses existing path variable) 2019-10-05 15:59:34 -04:00
Amanjeev Sethi
3c25dba9b4 Revert "Fix (command:clean): removes error message 'dir not found' if 'clean' is run multiple times"
This reverts commit 2387942588.
2019-10-05 15:57:10 -04:00
Amanjeev Sethi
2387942588 Fix (command:clean): removes error message 'dir not found' if 'clean' is run multiple times 2019-10-05 15:01:01 -04:00
Eric Huss
93c9ae5700
Merge pull request #1037 from Flying-Toast/prefers-color-scheme
Automatically use a dark theme according to 'prefers-color-scheme'
2019-10-05 11:33:52 -07:00
Eric Huss
9efa9fd1c4
Merge pull request #1052 from morphologue/fix-sidebar-autoscroll
Fix #1029 sidebar not auto-scrolling
2019-10-05 10:19:29 -07:00
Eric Huss
8a33407cc5
Merge pull request #1051 from segfaultsourcery/fix-small-gitignore-bug
I fixed a small gitignore bug
2019-10-05 10:11:16 -07:00
morphologue
699844a5c3 Fix #1029 sidebar not auto-scrolling 2019-10-05 16:54:09 +10:00
Flying-Toast
9bdec5e7cc preferred-dark-theme defaults to default-theme 2019-10-04 19:32:03 -04:00
Kim Hermansson
930f730361 The .gitignore file is now searched for recursively.
Removed a warning if .gitignore is missing.
2019-10-04 22:56:56 +02:00
Eric Huss
09c738468f
Merge pull request #1047 from rnitta/patch-1
Fix Search::use_boolean_and documents
2019-10-04 12:39:05 -07:00
Kim Hermansson
a3d1afdd1f This fixes a small bug where the gitignore location can be misinterpreted to be in the folder "above" where it actually is. 2019-10-04 19:44:36 +02:00
Kim Hå
8e8e53ae15 Added support for gitignore files. (#1044)
* Added support for gitignore files.
The watch command will now ignore files based on gitignore. This can be useful for when your editor creates cache or swap files.

* Ran cargo fmt.

* Made the code a bit tidier based on input from other Rust programmers.
Changed the type of the closure back to use PathBuf, not &PathBuf.
Reduced nesting.
2019-10-04 14:59:17 +02:00
rnitta
5fe801a7d1 fix Search::use_boolean_and documents 2019-10-03 11:35:42 +09:00
Eric Huss
a6f317e352 Update highlight.js (#1041) 2019-09-30 00:07:54 +02:00
Eric Huss
a058da8b74 Fix merge conflict. 2019-09-26 11:03:51 -07:00
Eric Huss
73be1292ab
Merge pull request #1035 from andymac-2/line-numbers
Added line numbers to editable sections of code.
2019-09-26 10:53:32 -07:00
Eric Huss
98ecd1178b
Merge pull request #1033 from TjeuKayim/log-deserialization-error-html-config
Log deserialization errors for [html.config]
2019-09-26 10:28:18 -07:00
Eric Huss
b88839cc25 Rustfmt for 1.38.
A minor change in the recent stable release.
2019-09-26 09:54:12 -07:00
Flying-Toast
b0ae14a2c7 Automatically use a dark theme according to 'prefers-color-scheme' 2019-09-25 19:11:28 -04:00
Andrew Pritchard
81ab2eb7db Added line numbers to editable sections of code.
- Added line numbers to config struct
- Added playpen_line_numbers field to hbs renderer.
- Added section to set `window.playpen_line_numbers = true` in page template
- Use line number global variable to show line numbers when required.
2019-09-24 21:27:02 +08:00
Tjeu Kayim
213171591a De-duplicate calling Config::html_config() 2019-09-22 21:48:49 +02:00
Tjeu Kayim
db13d8e561 Log HtmlConfig deserialization errors 2019-09-22 21:48:03 +02:00
Carol (Nichols || Goulding)
a873d46871 Implement a markdown renderer (#1018)
Use case: when trying to `mdbook test` a file that has many `include`
directives, and a test fails, the line numbers in the `rustdoc` output
don't match the line numbers in the original markdown file.

Turning on the markdown renderer implemented here lets you see what is
being passed to `rustdoc` by saving the markdown after the preprocessors
have run.

This renderer could be helpful for debugging many preprocessors, but
it's probably not useful in the general case, so it's turned off by
default.
2019-08-30 12:20:53 +02:00
Carol (Nichols || Goulding)
ce0c5f1d07 Another refactoring in links.rs (#1001)
* Extract the concept of a link having a range or anchor specified

So that other kinds of links can use this concept too.

* Extract a function for parsing range or anchor
2019-08-13 11:19:42 +02:00
Stephan Druskat
e880fb6339 Fix #823: Apply default padding to table headers
This PR fixes #823 by applying the default padding for table cells (`padding: 3px 20px;`) to header cells.
2019-08-09 09:48:56 -07:00
Eric Huss
a8d6337ac6
Merge pull request #994 from WofWca/nav-chapters-style
ui: Improve next/prev chapter links' style
2019-08-07 11:27:20 -07:00
Eric Huss
f37a89cd4c
Merge pull request #998 from integer32llc/links-improvements
Refactoring of some functionality in links.rs
2019-08-07 10:33:11 -07:00
Eric Huss
aaeb3e2852
Merge pull request #985 from Michael-F-Bryan/enable-caching
Allow backends to cache previous results
2019-08-07 10:26:06 -07:00
Carol (Nichols || Goulding)
8c4b292d58
Rework a match to possibly be more understandable 2019-08-06 22:14:17 -04:00
Carol (Nichols || Goulding)
40159362c0
Unnest another conditional 2019-08-06 22:14:16 -04:00
Carol (Nichols || Goulding)
aa67245743
Unnest a conditional 2019-08-06 22:14:16 -04:00
Carol (Nichols || Goulding)
d968443074
Don't bother splitting the path after the 3rd colon 2019-08-06 22:14:16 -04:00
Carol (Nichols || Goulding)
3716123e10
Increase test coverage of parse_include_path 2019-08-06 22:14:16 -04:00
Carol (Nichols || Goulding)
50a2ec3cf1
Ensure the iterator will always return None after the first None
I'm not sure in what cases this iterator might possibly return Some
again, but let's make absolutely sure.
2019-08-06 22:14:16 -04:00
Carol (Nichols || Goulding)
07459aef60
Factor out the use of different ranges from linktype
This eliminates some duplication and will enable different kinds of
LinkTypes to have line number ranges.

Implement `From` for the std `Range` types to enable easier
construction.

The new code reaaalllly makes me wish for a delegation mechanism though
:(
2019-08-06 22:14:16 -04:00
WofWca
1c5dc1e310 ui: Improve next/prev chapter links' style 2019-08-03 22:56:25 +08:00
Sorin Davidoi
e512850c13 fix(css/chrome): Use standard property for scrollbar (#816)
This was recently standardized and is currently implemented in Firefox Nightly.
2019-07-28 21:01:33 +02:00
Michael Bryan
bb412edf53
Made sure the tests pass 2019-07-21 04:32:28 +08:00
Michael Bryan
e56c41a1c2
The HTML renderer now cleans its own build directory 2019-07-21 02:37:09 +08:00
Michael Bryan
d1b5a8f982
The MDBook::build() method no longer cleans the renderer's build directory 2019-07-21 02:35:18 +08:00