Commit Graph

393 Commits

Author SHA1 Message Date
Eric Huss c9cfe22fd6 Apply some code style changes. 2023-05-28 14:04:58 -07:00
Jannik Obermann 7df1d8c838 Support hidden lines in languages other than Rust
Co-Authored-By: thecodewarrior <5467669+thecodewarrior@users.noreply.github.com>
2023-05-28 14:04:54 -07:00
Eric Huss 1db52ff531 Fix search for custom heading attributes 2023-05-28 12:03:03 -07:00
Eric Huss 34e5ef22a0 Don't include empty class attribute. 2023-05-28 11:33:00 -07:00
ImUrX c8a5adcee9 fix more mistakes 2023-05-28 10:47:14 -07:00
ImUrX ecdb411711 fix mistakes 2023-05-28 10:47:14 -07:00
ImUrX a4e206168d Add working heading extension 2023-05-28 10:47:13 -07:00
Eric Huss 45a8575b95 Apply clippy::needless_borrow 2023-05-13 09:44:11 -07:00
Eric Huss 01047846a9 Don't copy the stock fonts if the user has overridden fonts.css.
This wasn't behaving as I was really intending.
2023-05-13 09:05:25 -07:00
Eric Huss 75a6d65e5a Don't warn on copy-fonts=true (the default) when fonts.css is overridden. 2023-05-13 08:51:04 -07:00
Tetsuya Morimoto 04016f3be6 Refactor the warning message related to copy_fonts so that a user simply configures it 2023-04-28 12:46:49 +09:00
Eric Huss c2d973997a Make fonts part of the theme. 2023-01-15 11:42:46 -08:00
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