Skip to content

Commit

Permalink
[mdman] Normalize newlines when rendering options
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaoliello committed Aug 19, 2024
1 parent a250d27 commit 8e2a37c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions crates/mdman/src/hbs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ impl HelperDef for OptionHelper<'_> {
// Render the block.
let block = t.renders(r, gctx, rc)?;

// Windows newlines can break some rendering, so normalize.
let block = block.replace("\r\n", "\n");

// Get the name of this page.
let man_name = gctx
.data()
Expand Down
2 changes: 1 addition & 1 deletion crates/mdman/tests/compare/expected/options.1
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Alternate syntax for optional value (with required = for disambiguation).
.sp
\fB\-\-split\-block\fR
.RS 4
An option where the description has a \fBblock statement that is split across multiple lines\fR
An option where the description has a \fBblock statement that is split across multiple lines\fR
.RE
.SH "EXAMPLES"
.sp
Expand Down
2 changes: 1 addition & 1 deletion crates/mdman/tests/compare/expected/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ A description of the command.


<dt class="option-term" id="option-options---split-block"><a class="option-anchor" href="#option-options---split-block"></a><code>--split-block</code></dt>
<dd class="option-desc">An option where the description has a <code>block statement that is split across multiple lines</code></dd>
<dd class="option-desc">An option where the description has a <code>block statement that is split across multiple lines</code></dd>


</dl>
Expand Down

0 comments on commit 8e2a37c

Please sign in to comment.