From 6207bdeb681142e9fa3731e6e0ee7fa8e6c120f5 Mon Sep 17 00:00:00 2001 From: quasicomputational Date: Sat, 6 Oct 2018 05:33:14 +0100 Subject: CommonMark writer: add plain text fallbacks. (#4531) Previously, the writer would unconditionally emit HTMLish output for subscripts, superscripts, strikeouts (if the strikeout extension is disabled) and small caps, even with raw_html disabled. Now there are plain-text (and, where possible, fancy Unicode) fallbacks for all of these corresponding (mostly) to the Markdown fallbacks, and the HTMLish output is only used when raw_html is enabled. This commit adds exported functions `toSuperscript` and `toSubscript` to `Text.Pandoc.Writers.Shared`. [API change] Closes #4528. --- test/command/4528.md | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 test/command/4528.md (limited to 'test') diff --git a/test/command/4528.md b/test/command/4528.md new file mode 100644 index 000000000..a60f6decf --- /dev/null +++ b/test/command/4528.md @@ -0,0 +1,156 @@ +# Rendering small caps, superscripts and subscripts with and without `raw_html` + +## Small caps + +``` +% pandoc --wrap=none -f latex -t commonmark-raw_html +This has \textsc{small caps} in it. +^D +This has SMALL CAPS in it. +``` + +``` +% pandoc --wrap=none -f latex -t commonmark+raw_html +This has \textsc{small caps} in it. +^D +This has small caps in it. +``` +``` + +``` +% pandoc --wrap=none -f latex -t markdown_strict+raw_html +This has \textsc{small caps} in it. +^D +This has small caps in it. +``` + +## Strikeout + +``` +% pandoc --wrap=none -f html -t commonmark-raw_html-strikeout +This has strikeout in it. +^D +This has strikeout in it. + +``` +% pandoc --wrap=none -f html -t commonmark+raw_html-strikeout +This has strikeout in it. +^D +This has strikeout in it. +``` + +``` +% pandoc --wrap=none -f html -t commonmark-raw_html+strikeout +This has strikeout in it. +^D +This has ~~strikeout~~ in it. +``` + +``` +% pandoc --wrap=none -f html -t commonmark+raw_html+strikeout +This has strikeout in it. +^D +This has ~~strikeout~~ in it. +``` + +``` +% pandoc --wrap=none -f html -t markdown_strict-raw_html-strikeout +This has strikeout in it. +^D +This has strikeout in it. +``` + +``` +% pandoc --wrap=none -f html -t markdown_strict+raw_html-strikeout +This has strikeout in it. +^D +This has strikeout in it. +``` + +``` +% pandoc --wrap=none -f html -t markdown_strict-raw_html+strikeout +This has strikeout in it. +^D +This has ~~strikeout~~ in it. +``` + +``` +% pandoc --wrap=none -f html -t markdown_strict+raw_html+strikeout +This has strikeout in it. +^D +This has ~~strikeout~~ in it. +``` + +## Superscript + +``` +% pandoc --wrap=none -f html -t commonmark-raw_html +This has superscript in it and 2 3 again. With emphasis: 2 3. With letters: foo. With a span: 2. +^D +This has ^(superscript) in it and ² ³ again. With emphasis: ^(*2* 3). With letters: ^(foo). With a span: ². +``` + +``` +% pandoc --wrap=none -f html -t commonmark+raw_html +This has superscript in it and 2 again. +^D +This has superscript in it and 2 again. +``` + +``` +% pandoc --wrap=none -f html -t markdown_strict-raw_html-superscript +This has superscript in it and 2 again. +^D +This has ^(superscript) in it and ² again. +``` + +``` +% pandoc --wrap=none -f html -t markdown_strict+raw_html-superscript +This has superscript in it and 2 again. +^D +This has superscript in it and 2 again. +``` + +``` +% pandoc --wrap=none -f html -t markdown_strict+raw_html+superscript +This has superscript in it and 2 again. +^D +This has ^superscript^ in it and ^2^ again. +``` + +## Subscript + +``` +% pandoc --wrap=none -f html -t commonmark-raw_html +This has subscript in it and 2 3 again. With emphasis: 2 3. With letters: foo. With a span: 2. +^D +This has \_(subscript) in it and ₂ ₃ again. With emphasis: \_(*2* 3). With letters: \_(foo). With a span: ₂. +``` + +``` +% pandoc --wrap=none -f html -t commonmark+raw_html +This has subscript in it and 2 again. +^D +This has subscript in it and 2 again. +``` + +``` +% pandoc --wrap=none -f html -t markdown_strict-raw_html-subscript +This has subscript in it and 2 again. +^D +This has _(subscript) in it and ₂ again. +``` + +``` +% pandoc --wrap=none -f html -t markdown_strict+raw_html-subscript +This has subscript in it and 2 again. +^D +This has subscript in it and 2 again. +``` + +``` +% pandoc --wrap=none -f html -t markdown_strict+raw_html+subscript +This has subscript in it and 2 again. +^D +This has ~subscript~ in it and ~2~ again. +``` -- cgit v1.2.3