Add a test for a fenced code block with an indent

This commit is contained in:
Eric Huss 2025-10-27 18:17:22 -07:00
parent f84b1a15b6
commit 3992bc18f5
6 changed files with 27 additions and 0 deletions

View file

@ -179,4 +179,8 @@ fn it_partitions_rust_source() {
),
("\n#![allow(foo)]\n\n#![allow(bar)]\n\n", "let x = 1;")
);
assert_eq!(
partition_rust_source(" // Example"),
(" ", "// Example")
);
}

View file

@ -223,3 +223,9 @@ Html text was:
fn html_blocks() {
BookTest::from_dir("rendering/html_blocks").check_all_main_files();
}
// Test for a fenced code block that is also indented.
#[test]
fn code_block_fenced_with_indent() {
BookTest::from_dir("rendering/code_blocks_fenced_with_indent").check_all_main_files();
}

View file

@ -0,0 +1,2 @@
[book]
title = "code_blocks_fenced_with_indent"

View file

@ -0,0 +1,6 @@
<h1 id="code-blocks-fenced-with-indent"><a class="header" href="#code-blocks-fenced-with-indent">Code blocks fenced with indent</a></h1>
<pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
</span><span class="boring"> fn main() {
</span>// This has a first line that is indented.
println!("hello");
<span class="boring">}</span></code></pre>

View file

@ -0,0 +1,3 @@
# Summary
- [Code blocks fenced with indent](./code-blocks-fenced-with-indent.md)

View file

@ -0,0 +1,6 @@
# Code blocks fenced with indent
```rust
// This has a first line that is indented.
println!("hello");
```