2

I want to use flag: Japan emoticon with unicode U+1F1EF U+1F1F5 as defined in the standard Full Emoji List, v12.0, inside markdown (rendered with Pandoc).

Given that this Emoticon is not defined inside Pandoc sourcecode: pandoc/Emoji.hs at master ยท jgm/pandoc, how can I use this inside the document? Or how can I define this in the Pandoc Source Code?

If possible please suggest a general solution that can parse multiple unicode emoji's, such as :thermometer: for , :jp: for .

An extensible code would read a csv file or data structure inside lua file:

jp,
thermometer,

and make string substitutions.

Porcupine
  • 513

2 Answers2

1

Unless there are counter indications against using the emoji directly, one could simply use the unicode representation.

The alternative would be to add this feature via a pandoc Lua filter. Save the following code into a file flag-jp.lua and pass it to pandoc via --lua-filter=flag-jp.lua. The file must be stored as UTF-8.

function Str (s)
  return pandoc.Str(s.text:gsub(':jp:', ''))
end

The flag can then be inserted by writing :jp: in Markdown.

tarleb
  • 456
1

This is more general than @tarleb solution.

ReplacementTable={
      [":jp:"] = "", 
      [":in:"] = "", 
      [":thermometer:"] = "", 
      [":snow_capped_mountain:"] = "  ", 
      [":beach:"] = "  ", 
      [":national_park:"] = "  ", 
      [":money_bag:"] = "  ", 
      [":see_no_evil_monkey:"] = "  ", 
      [":hear_no_evil_monkey:"] = "  ", 
      [":speak_no_evil_monkey:"] = "  "}

function Str (s)
  return pandoc.Str(s.text:gsub("%S+", ReplacementTable))
end
Porcupine
  • 513