mdBook/src
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
..
book Fix Clippy lints 2022-06-27 23:08:45 +02:00
cmd Fix Clippy lints 2022-06-27 23:08:45 +02:00
preprocess Fix Clippy lints 2022-06-27 23:08:45 +02:00
renderer Trim trailing whitespace in Rust code blocks 2022-08-10 03:11:08 +02:00
theme Merge pull request #1806 from ehuss/button-overlap 2022-06-27 13:58:17 -07:00
utils Merge pull request #1832 from ISSOtm/clippy 2022-06-27 14:28:39 -07:00
config.rs Fix Clippy lints 2022-06-27 23:08:45 +02:00
lib.rs Fix Clippy lints 2022-06-27 23:08:45 +02:00
main.rs add first_chapter function 2022-05-10 11:16:22 -07:00