Skip to content

Commit

Permalink
Fix inline text escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
kapouer committed Dec 6, 2022
1 parent f4d587c commit 4114662
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ function getCellAlign(align) {
export function strong(text) {
this.jumps = false;
return '\\fB'
+ manEsc(text)
+ text
+ '\\fR';
}

export function em(text) {
this.jumps = false;
return '\\fI'
+ manEsc(text)
+ text
+ '\\fR';
}

Expand All @@ -158,7 +158,7 @@ export function br() {

export function del(text) {
return "-"
+ manEsc(text)
+ text
+ "-";
}

Expand Down
2 changes: 1 addition & 1 deletion test/man/markdown_syntax.1
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ accident, by writing something like this:
.fi
.RE
.P
In other words, a \fInumber\\\-period\\\-space\fR sequence at the beginning of a
In other words, a \fInumber\-period\-space\fR sequence at the beginning of a
.br
line\. To avoid this, you can backslash\-escape the period:
.RS 2
Expand Down
8 changes: 8 additions & 0 deletions test/man/regressions.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.TH "REGRESSIONS" "7" "January 1979"
.SH "NAME"
\fBregressions\fR \- issues
.SH inlines
.P
This should be \fI(a \fBb\fP)\fR ok\.
.P
This should not double escape \fBpkg\-js\-tools\fR\|\.
8 changes: 8 additions & 0 deletions test/md/regressions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# regressions(7) -- issues

## inlines

This should be _(a `b`)_ ok.

This should not double escape **pkg-js-tools**.

2 changes: 1 addition & 1 deletion test/out/markdown_syntax.out
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ BBLLOOCCKK EELLEEMMEENNTTSS
accident, by writing something like this:
1986. What a great season.

In other words, a _n_u_m_b_e_r_\_-_p_e_r_i_o_d_\_-_s_p_a_c_e sequence at the beginning of a
In other words, a _n_u_m_b_e_r_-_p_e_r_i_o_d_-_s_p_a_c_e sequence at the beginning of a
line. To avoid this, you can backslash-escape the period:
1986\. What a great season.

Expand Down
11 changes: 11 additions & 0 deletions test/out/regressions.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
REGRESSIONS(7) Miscellaneous Information Manual REGRESSIONS(7)

NNAAMMEE
rreeggrreessssiioonnss - issues

iinnlliinneess
This should be _(_a bb_) ok.

This should not double escape ppkkgg--jjss--ttoooollss.

January 1979 REGRESSIONS(7)

0 comments on commit 4114662

Please sign in to comment.