1
Fork 0
Commit graph

37 commits

Author SHA1 Message Date
Jan-Erik Rediger 8ec529e2bf Apply clippy suggestion 2023-05-15 21:24:31 +02:00
Jan-Erik Rediger c9484d562e Always convert CRLF into LF-only line endings.
CRLF lineendings will happen on Windows,
but they shouldn't matter for Markdown content.

pulldown-cmark will parse them _nearly_ the same.
`<!-- toc -->\r\n` will actually be 2 HTML elements:
the `<!-- toc -->` part and a `\n` part,
whereas `<!-- toc -->\n` will be just one: `<!-- toc -->\n`.
That throws off our marker parser because we're looking for the latter only.

So by stripping our the CR (`\r`) we don't need to special-case anything.
The rendering will be the same.

Closes 
2023-05-15 21:21:06 +02:00
Jan-Erik Rediger 35e0f51672 Handle empty documents.
Fixes 
2023-01-09 21:51:21 +01:00
Jan-Erik Rediger 2300bdbc45 Upgrade dependencies and fix clap breakage
Fix 
2022-12-15 20:58:25 +01:00
Jan-Erik Rediger 5fc9522e5f Dependency updates 2022-05-26 23:01:33 +02:00
Jan-Erik Rediger adde0c8cfb Avoid roundtripping through pulldown-cmark
Roundtripping markdown is actually quite hard.
We don't actually require that.
All we need is once parsing the markdown to find the right marker and
the headings.
We then manually generate markdown and all other content can be copied
unparsed again.
2022-01-25 21:04:50 +01:00
Jan-Erik Rediger ddbe8125cd Add minimal docs 2021-06-23 12:08:00 +02:00
Jan-Erik Rediger a8a2e649df Move all tests to be integration tests only 2021-06-23 12:05:39 +02:00
Jan-Erik Rediger cb9413d50f Bugfix: Use slug (normalied header) to decide whether to use a different link anchor
We simply used the wrong thing to check it!

Fixes 
2021-04-21 10:26:43 +02:00
Jan-Erik Rediger 2001e01ffa Don't write the TOC if no marker was found
Fixes 
2021-04-06 18:52:25 +02:00
Jan-Erik Rediger 9a9288085f Pass config everywhere 2021-01-06 14:55:47 +01:00
Jan-Erik Rediger 8916d17e4b Parse max-level 2021-01-06 14:55:45 +01:00
Jan-Erik Rediger 6e8b632a30 Refactor: parse config in a central place 2021-01-06 14:54:45 +01:00
Jan-Erik Rediger 01f2879e10 cargo fmt 2021-01-06 14:27:35 +01:00
Rene Leveille 6c96ceea1f Allow custom ToC markers through configuration 2021-01-06 14:16:43 +01:00
NBonaparte f8f09d441e
Generate unique slugs for identically named headers 2021-01-06 13:52:21 +01:00
Jan-Erik Rediger 8dceed5003 Upgrade dependencies, including mdbook itself 2020-09-28 17:25:03 +02:00
Jan-Erik Rediger 2d5b40214c Start normalizing the levels based on the first header's level 2020-06-24 11:33:46 +02:00
Jan-Erik Rediger b220318021 Try to fix indentation levels when header levels have holes 2020-06-02 11:14:23 +02:00
Jan-Erik Rediger 71a9f56685 Fix regression: newlines around code blocks were fixed upstream 2020-05-18 11:40:52 +02:00
Jan-Erik Rediger 0fc01be277 Combine multiple elements inside a single header 2020-05-06 10:56:19 +02:00
Jan-Erik Rediger c22a98ad1d Upgrade dependencies to fix nested HTML/markdown 2020-04-22 12:37:53 +02:00
Jan-Erik Rediger ead6cac96d Bug fix: Enable the same markdown extensions as mdbook 2020-04-08 10:21:15 +02:00
Jan-Erik Rediger f08570bf00 Update dependencies
And less newlines
2020-04-06 10:39:21 +02:00
Jan-Erik Rediger 51f3adb606 Upgrade dependencies 2020-04-06 10:20:29 +02:00
Jan-Erik Rediger 39470841bc Support inline-code in headers used for ToC 2019-08-21 09:10:23 -07:00
Jan-Erik Rediger 3979de2d32 auto format 2019-07-16 12:18:33 +02:00
Jan-Erik Rediger 01f997792e Include version 2019-07-16 12:18:23 +02:00
Jan-Erik Rediger d175694f35 Fix typo in binary description 2019-07-10 21:23:29 +02:00
Jan-Erik Rediger 7d31d359a3 Fix test by expecting one more newline 2019-07-10 15:20:16 +02:00
Jan-Erik Rediger 080d0c7f0a Use pulldown types and force deref to compare with string slice 2019-07-09 11:15:31 +02:00
Jan-Erik Rediger 80faf141da Update dependencies and refactor mdbook-toc into a preprocessor 2019-07-09 11:15:10 +02:00
Jan-Erik Rediger 8c2a8c2d5c Include more layers 2018-10-08 12:14:07 +02:00
Jan-Erik Rediger 0b2613bee0 Use mdbook 0.2.2-alpha 2018-09-18 16:07:06 +02:00
Jan-Erik Rediger c87fdf7e3e Add a test 2018-09-13 14:26:44 +02:00
Jan-Erik Rediger 61601fde90 Only use top- and second-level headings for the ToC 2018-07-20 12:06:54 +02:00
Jan-Erik Rediger 7b492cba91 init 2018-07-19 18:10:08 +02:00