lib/kramdown/man/converter.rb in kramdown-man-1.0.0 vs lib/kramdown/man/converter.rb in kramdown-man-1.0.1
- old
+ new
@@ -899,10 +899,25 @@
#
# @return [String]
# The roff output.
#
def convert_codespan(codespan)
- "\\fB#{codespan.value}\\fR"
+ # ``` code fence blocks are parsed as kd:codespans
+ if codespan.options[:codespan_delimiter] == '```'
+ # ignore the first and last newlines
+ contents = escape(codespan.value[1..-2])
+
+ <<~ROFF
+ .PP
+ .RS 4
+ .EX
+ #{contents}
+ .EE
+ .RE
+ ROFF
+ else
+ "\\fB#{escape(codespan.value)}\\fR"
+ end
end
#
# Converts a `kd:a` element.
#