brick-0.52.1: A declarative terminal user interface library

Safe Haskell | None
Language | Haskell2010

Brick.Markup

Description

This module provides an API for turning "markup" values into widgets. This module uses the Data.Text.Markup interface in this package to assign attributes to substrings in a text string; to manipulate markup using (for example) syntax highlighters, see that module.

Synopsis

- data Markup a
- markup :: (Eq a, GetAttr a) => Markup a -> Widget n
- (@?) :: Text -> AttrName -> Markup AttrName
- class GetAttr a where
  - getAttr :: a -> RenderM n Attr

# Documentation

data Markup a Source #

Markup with metadata type `a` assigned to each character.

#### Instances

Instances details

Show a => Show (Markup a) Source # |
Instance details Defined in Data.Text.Markup Methods showsPrec :: Int -> Markup a -> ShowS show :: Markup a -> String showList :: [Markup a] -> ShowS
Monoid a => IsString (Markup a) Source # |
Instance details Defined in Data.Text.Markup Methods fromString :: String -> Markup a
Semigroup (Markup a) Source # |
Instance details Defined in Data.Text.Markup Methods (<>) :: Markup a -> Markup a -> Markup a sconcat :: NonEmpty (Markup a) -> Markup a stimes :: Integral b => b -> Markup a -> Markup a
Monoid (Markup a) Source # |
Instance details Defined in Data.Text.Markup Methods mempty :: Markup a mappend :: Markup a -> Markup a -> Markup a mconcat :: [Markup a] -> Markup a

markup :: (Eq a, GetAttr a) => Markup a -> Widget n Source #

Build a widget from markup.

(@?) :: Text -> AttrName -> Markup AttrName Source #

Build a piece of markup from text with an assigned attribute name. When the markup is rendered, the attribute name will be looked up in the rendering context's `AttrMap` to determine the attribute to use for this piece of text.

class GetAttr a where Source #

A type class for types that provide access to an attribute in the rendering monad. You probably won't need to instance this.

Methods

getAttr :: a -> RenderM n Attr Source #

Where to get the attribute for this attribute metadata.

#### Instances

Instances details

GetAttr Attr Source # |
Instance details Defined in Brick.Markup Methods getAttr :: Attr -> RenderM n Attr Source #
GetAttr AttrName Source # |
Instance details Defined in Brick.Markup Methods getAttr :: AttrName -> RenderM n Attr Source #