pandoc-3.1: Conversion between markup formats
CopyrightCopyright (C) 2006-2023 John MacFarlane
LicenseGNU GPL, version 2 or above
MaintainerJohn MacFarlane <jgm@berkeley.edu>
Stabilityalpha
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Text.Pandoc.XML

Description

Functions for escaping and formatting XML.

Synopsis

Documentation

escapeCharForXML :: Char -> Text Source #

Escape one character as needed for XML.

escapeStringForXML :: Text -> Text Source #

Escape string as needed for XML. Entity references are not preserved.

escapeNCName :: Text -> Text Source #

Converts a string into an NCName, i.e., an XML name without colons. Disallowed characters are escaped using ux%x, where %x is the hexadecimal unicode identifier of the escaped character.

inTags :: (HasChars a, IsString a) => Bool -> Text -> [(Text, Text)] -> Doc a -> Doc a Source #

Put the supplied contents between start and end tags of tagType, with specified attributes and (if specified) indentation.

selfClosingTag :: (HasChars a, IsString a) => Text -> [(Text, Text)] -> Doc a Source #

Return a self-closing tag of tagType with specified attributes

inTagsSimple :: (HasChars a, IsString a) => Text -> Doc a -> Doc a Source #

Put the supplied contents between start and end tags of tagType.

inTagsIndented :: (HasChars a, IsString a) => Text -> Doc a -> Doc a Source #

Put the supplied contents in indented block btw start and end tags.

toEntities :: Text -> Text Source #

Escape all non-ascii characters using numerical entities.

toHtml5Entities :: Text -> Text Source #

Escape all non-ascii characters using HTML5 entities, falling back to numerical entities.

fromEntities :: Text -> Text Source #

Unescapes XML entities