Eric Huss
f32bd6f945
Show the currently selected theme.
2022-11-21 15:27:39 -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
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
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
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
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
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
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
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
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
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
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
Daniel Morawetz
7b1241d0f2
Revert "Make page-break not configurable"
...
This reverts commit 0eb23efd44
.
2022-01-17 18:03:52 +01:00
Guillaume Gomez
ddb0d2396f
Update pulldown-cmark version
2021-12-25 13:46:27 +01:00
josh rotenberg
1c0983b811
use pulldown cmarks curly quotes
2021-11-19 17:26:30 -08: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
josh rotenberg
b87c231fc3
first pass at 2021 support
2021-07-04 14:44:23 -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
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
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
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
16c5ec4d74
Remove chapter_begin id from print output.
2021-05-22 15:12:54 -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
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
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