Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/generation/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ fn gen_code_block(code_block: &CodeBlock, context: &mut Context) -> PrintItems {
}
}

fn gen_code(code: &Code, _: &mut Context) -> PrintItems {
fn gen_code(code: &Code, context: &mut Context) -> PrintItems {
let text = code.code.trim();
let mut backtick_text = "`";
let mut separator = "";
Expand All @@ -458,7 +458,11 @@ fn gen_code(code: &Code, _: &mut Context) -> PrintItems {
}
}

format!("{0}{1}{2}{1}{0}", backtick_text, separator, text).into()
let mut items = PrintItems::new();
items.push_string(format!("{0}{1}", backtick_text, separator));
items.extend(gen_str(&code.code, context));
items.push_string(format!("{1}{0}", backtick_text, separator));
items
}

fn gen_text(text: &Text, context: &mut Context) -> PrintItems {
Expand Down
8 changes: 8 additions & 0 deletions tests/specs/Code/Code_Inline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,11 @@ Testing
`` `test` ``
`` `test` test ``
`` test `test` ``

!! inline code newlines !!
`Inline code can
include newlines.`

[expect]
`Inline code can
include newlines.`
9 changes: 8 additions & 1 deletion tests/specs/Code/Code_Inline_TextWrap_Always.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
~~ textWrap: always ~~
~~ textWrap: always, lineWidth: 40 ~~
!! should format inline blocks !!
Testing ` this ` out.

Expand All @@ -18,3 +18,10 @@ Testing

[expect]
Testing `this` out.

!! Wrapping within inline code blocks !!
`long code blocks should have their text wrapped.`

[expect]
`long code blocks should have their text
wrapped.`