text-markup-0.1: A data structure for mapping metadata to text subsequences

Safe HaskellSafe
LanguageHaskell2010

Data.Text.Markup

Description

Annotate subsequences of a Text string with arbitrary metadata.

Synopsis

Documentation

data Markup a Source #

Markup. This contains text along with markup.

Instances

Eq a => Eq (Markup a) Source # 

Methods

(==) :: Markup a -> Markup a -> Bool #

(/=) :: Markup a -> Markup a -> Bool #

Show a => Show (Markup a) Source # 

Methods

showsPrec :: Int -> Markup a -> ShowS #

show :: Markup a -> String #

showList :: [Markup a] -> ShowS #

toMarkup :: Text -> a -> Markup a Source #

Convert a Text value into Markup with the accompanying metadata value assigned to the entire Text sequence.

fromMarkup :: Markup a -> [(Text, a)] Source #

Recover the original text along with metadata assigned with markRegion.

markRegion Source #

Arguments

:: Eq a 
=> Int

The starting index to mark.

-> Int

The size of the region to mark.

-> a

The metadata to store for this region.

-> Markup a

The markup to modify.

-> Markup a 

Mark a region of text with the specified metadata.