lerzegov/elm-markup/1.0.0

Renamed to lerzegov/elm-markup-fork. It is published under that name, and new versions come out there.

Versions published as lerzegov/elm-markup still install under that name. 1 version could not be recovered and cannot be installed.

Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: no fork with tag 1.0.0 found (28 same-name repos checked); https://github.com/lerzegov/elm-markup-fork has tag 1.0.0, but not a package Elm could build from it; https://github.com/lerzegov/elm-markup-fork commit 1ea589d5d7f182e39d0a124ab1561a7e076e4f31 (the tag's commit when Software Heritage visited) has tag 1.0.0, but not a package Elm could build from it; no cached copy. Use another version.

Details

Mark.New

Create a new Mark.Block that can be added to your document using Mark.Edit.replace or Mark.Edit.insertAt.

Let's say we are capturing a basic diagram in our document and we want to dynamically insert a circle.

We can make a new circle by writing the following function

import Mark.New as New


type alias Circle =
    { x : Int
    , y : Int
    , label : String
    }


circle : Circle -> Mark.New.Block
circle details =
    New.record "Circle"
        [ ( "label", New.string details.label )
        , ( "x", New.int details.x )
        , ( "y", New.int details.y )
        ]

And then insert our newly made circle using Mark.Edit.insertAt.

Note: The document will only accept edits which are valid.

type alias Block =

Primitives

string : String -> Block
int : Int -> Block
float : Float -> Block
bool : Bool -> Block

Blocks

block : String -> Block -> Block
record : String -> List ( String, Block ) -> Block
many : List Block -> Block
bullet : List Block -> Block
numbered : Int -> List Block -> Block

Text

Here's an example of creating some text.

newText =
    New.text
        [ Mark.unstyled "Look at my "
        , Mark.bold "cool"
        , Mark.unstyled " new text!"
        ]
type alias Text =
text : List Text -> Block
unstyled : String -> Text
bold : String -> Text
italics : String -> Text
strike : String -> Text
type alias Styles =
{ bold : Bool
, italic : Bool
, strike : Bool
}
styled : Styles -> String -> Text

Text Annotation

{ name : String
, text : List ( Styles, String )
, fields : List ( String, Block )
}
-> Text
New.annotation
    { name = "link"
    , text =
        [ New.unstyled "my link to the elm website!" ]
    , fields =
        [ ( "url", Mark.string "https://elm-lang.com" ) ]
    }
{ name : String
, text : String
, fields : List ( String, Block )
}
-> Text