diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 2a8835263..3cd9a0892 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -108,11 +108,20 @@ defaultWriterState = WriterState {stNotes= [], stMath = False, stQuotes = False, strToHtml :: String -> Html strToHtml ('\'':xs) = preEscapedString "\'" `mappend` strToHtml xs strToHtml ('"' :xs) = preEscapedString "\"" `mappend` strToHtml xs -strToHtml xs@(_:_) = case break (\c -> c == '\'' || c == '"') xs of +strToHtml (x:xs) | needsVariationSelector x + = preEscapedString [x, '\xFE0E'] `mappend` strToHtml xs +strToHtml xs@(_:_) = case break (\c -> c == '\'' || c == '"' || + needsVariationSelector c) xs of (_ ,[]) -> toHtml xs (ys,zs) -> toHtml ys `mappend` strToHtml zs strToHtml [] = "" +-- See #5469: this prevents iOS from substituting emojis. +needsVariationSelector :: Char -> Bool +needsVariationSelector '↩' = True +needsVariationSelector '↔' = True +needsVariationSelector _ = False + -- | Hard linebreak. nl :: WriterOptions -> Html nl opts = if writerWrapText opts == WrapNone diff --git a/test/command/4235.md b/test/command/4235.md index e6e321841..8bbf43ff9 100644 --- a/test/command/4235.md +++ b/test/command/4235.md @@ -6,7 +6,7 @@ This.^[Has a footnote.]

    -
  1. Has a footnote.

  2. +
  3. Has a footnote.↩︎

``` diff --git a/test/writer.html4 b/test/writer.html4 index 4d5d11897..6d15f239e 100644 --- a/test/writer.html4 +++ b/test/writer.html4 @@ -535,14 +535,14 @@ Blah

    -
  1. Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.

  2. +
  3. Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.↩︎

  4. Here’s the long note. This one contains multiple blocks.

    Subsequent blocks are indented to show that they belong to the footnote (as with list items).

      { <code> }
    -

    If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.

  5. -
  6. This is easier to type. Inline notes may contain links and ] verbatim characters, as well as [bracketed text].

  7. -
  8. In quote.

  9. -
  10. In list.

  11. +

    If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.↩︎

    +
  12. This is easier to type. Inline notes may contain links and ] verbatim characters, as well as [bracketed text].↩︎

  13. +
  14. In quote.↩︎

  15. +
  16. In list.↩︎

diff --git a/test/writer.html5 b/test/writer.html5 index e0b30f4af..88b382ed2 100644 --- a/test/writer.html5 +++ b/test/writer.html5 @@ -537,14 +537,14 @@ Blah

    -
  1. Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.

  2. +
  3. Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.↩︎

  4. Here’s the long note. This one contains multiple blocks.

    Subsequent blocks are indented to show that they belong to the footnote (as with list items).

      { <code> }
    -

    If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.

  5. -
  6. This is easier to type. Inline notes may contain links and ] verbatim characters, as well as [bracketed text].

  7. -
  8. In quote.

  9. -
  10. In list.

  11. +

    If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.↩︎

    +
  12. This is easier to type. Inline notes may contain links and ] verbatim characters, as well as [bracketed text].↩︎

  13. +
  14. In quote.↩︎

  15. +
  16. In list.↩︎