Skip to content

Latest commit

 

History

History
325 lines (200 loc) · 4.69 KB

markup.md

File metadata and controls

325 lines (200 loc) · 4.69 KB

markup

module A generalized data format to represent human readable contents. Though it is not meant to represent HTML nodes.

Bold

data A bold portion of inline text.

Bold "text"

Properties

  • child - At least one child of type Markup.

Code

data Some preformatted inline code.

Code text

Properties

  • text - Some text. Markup not supported.

CodeBlock

data A block of preformatted multiline code.

CodeBlock "lithia", "text"

Properties

  • language - Maybe the language as string. Implementations must support Some, None and String.
  • text - The text itself as String.

Format

data A specific markup format to convert to.

Properties

  • convert markup - Converts given markup to this format.

FormatWitness

enum A more generalized form of a markup.Format. Allows to use plain functions and whole modules as format.

Cases

Heading

data A heading of a specific nesting level.

Heading 5, "title"

Properties

  • level - The level of nesting. An Int, typically in the range of one to six.
  • child - At least one child of type Markup.

Image

data An embedded image.

Image url, alt

Properties

  • url - The url of the image. Markup not supported.
  • alt - Alternatively displayed text in case the image can't be loaded or for accessibility. Markup not supported.

Italic

data An italic portion of inline text.

Italic "text"

Properties

  • child - At least one child of type Markup.

Link

data A link to a resource.

Link child, url

Properties

  • child - At least one child of type Markup. Used to display the link.
  • url - The url to point to. Markup not supported.

Markup

enum A recursive enum of markup nodes.

Cases

OrderedList

data An ordered list. Requires a list of children.

OrderedList [

  1. item
  2. another

]

Properties

  • children - A list of Markup children.

Paragraph

data A paragraph with some blank lines around.

Paragraph [ "First", "Second" ]

Properties

  • child - At least one child of type Markup.

UnorderedList

data An unordered list. Requires a list of children.

UnorderedList [

  • item
  • another

]

Properties

  • children - A list of Markup children.

b

func b

bold text

code

func code

A Code block.

convert

func convert markup, targetFormatWitness

Converts some markup to a target format.

from

func from witness

Creates a Format from a given FormatWitness.

group

func group list

A list of markup for better readbility.

h1

func h1

h2

func h2

h3

func h3

h4

func h4

h5

func h5

h6

func h6

i

func i

italic text

img

func img

An image with url and alt.

inline

func inline list

Some inline text. Ignores empty elements. Adds spaces.

li

func li item

A list item for better readability.

link

func link

A link with title and url.

ol

func ol child

An ordered list. Ignores empty lines.

p

func p child

A paragraph. Ignores empty lines.

pre

func pre

Preformatted inline code.

ref

func ref child, name

An internal ref to a heading.

text

func text str

Constant text for better readbility.

ul

func ul child

An unordered list. Ignores empty lines.