pandoc/test/command/gfm.md
Anders Waldenborg ec30fb37c1 Wrap emojis in span nodes (#4759)
Text.Pandoc.Emoji now exports `emojiToInline`, which returns a Span inline containing the emoji character and some attributes with metadata (class `emoji`, attribute `data-emoji` with emoji name).  Previously, emojis (as supported in Markdown and CommonMark readers, e.g "😄")
were simply translated into the corresponding unicode code point.  By wrapping them in Span
nodes, we make it possible to do special handling such as giving them a special font
in HTML output.  We also open up the possibility of treating them differently when the
`--ascii` option is selected (though that is not part of this commit).

Closes #4743.
2018-07-15 15:14:40 -07:00

1.6 KiB

gfm tests:

% pandoc -f gfm -t native
| Fruit | Price |
| ----- | ----: |
| apple | 0.13  |
| orange|1.12|
^D
[Table [] [AlignDefault,AlignRight] [0.0,0.0]
 [[Plain [Str "Fruit"]]
 ,[Plain [Str "Price"]]]
 [[[Plain [Str "apple"]]
  ,[Plain [Str "0.13"]]]
 ,[[Plain [Str "orange"]]
  ,[Plain [Str "1.12"]]]]]
% pandoc -f gfm -t native
~~stricken out~~
^D
[Para [Strikeout [Str "stricken",Space,Str "out"]]]
% pandoc -f gfm -t native
# Header
## Header
# -foo-bar_baz
^D
[Header 1 ("header",[],[]) [Str "Header"]
,Header 2 ("header-1",[],[]) [Str "Header"]
,Header 1 ("-foo-bar_baz",[],[]) [Str "-foo-bar_baz"]]
% pandoc -f gfm -t native
My:thumbsup:emoji:heart:
^D
[Para [Str "My",Span ("",["emoji"],[("data-emoji","thumbsup")]) [Str "\128077"],Str "emoji",Span ("",["emoji"],[("data-emoji","heart")]) [Str "\10084\65039"]]]
% pandoc -f gfm -t native
"hi"
^D
[Para [Str "\"hi\""]]
% pandoc -f gfm+smart -t native
"hi"
^D
[Para [Str "\8220hi\8221"]]
% pandoc -t gfm -f native
[Table [Str "The",Space,Str "caption."] [AlignDefault,AlignRight] [0.0,0.0]
 [[Plain [Str "Fruit"]]
 ,[Plain [Str "Price"]]]
 [[[Plain [Str "apple"]]
  ,[Plain [Str "0.13"]]]
 ,[[Plain [Str "orange"]]
  ,[Plain [Str "1.12"]]]]]
^D
| Fruit  | Price |
| ------ | ----: |
| apple  |  0.13 |
| orange |  1.12 |

The caption.
% pandoc -f gfm-smart -t gfm+smart
“hi”
^D
"hi"
% pandoc -f gfm+smart -t gfm-smart
"hi"
^D
“hi”
% pandoc -f gfm+smart -t gfm+smart
"hi"
^D
"hi"
% pandoc -f gfm+hard_line_breaks -t native
hi
hi
^D
[Para [Str "hi",LineBreak,Str "hi"]]