[{"name":"Markdown.Elm","comment":" Render Markdown text to Html using one of the\noptions defined in the `Option` module.\n\n@docs toHtml, toHtmlWithTOC, toHtmlWithExternaTOC\n\n","unions":[],"aliases":[],"values":[{"name":"toHtml","comment":" Parse the input and render it to Html, e.g.,\n\ntoHtml ExtendedMath \"Pythagoras said: $a^2 + b^2 c^2$.\"\n\n","type":"Markdown.Option.Option -> String.String -> Html.Html msg"},{"name":"toHtmlWithExternaTOC","comment":" Like `toHtmlWithTOC`, but constructs returns a record,\none field of which is the rendered document,\nanther of which is the rendered table of contents.\n","type":"Markdown.Option.Option -> String.String -> { title : Html.Html msg, toc : Html.Html msg, document : Html.Html msg }"},{"name":"toHtmlWithTOC","comment":" Like `toHtml`, but constructs a table of contents.\n","type":"Markdown.Option.Option -> String.String -> Html.Html msg"}],"binops":[]},{"name":"Markdown.ElmWithId","comment":" Use this module if you need to edit math + markdown _and_\nrequire optimizations for speed and a smooth editing experience.\n\nThe\nfunction `parse` yields a syntax tree (AST: abstract syntax tree). The functions `renderHtml`,\n`renderHtmlWithTOC`, and `renderHtmlWithExternaTOC` render the\nAST in various forms, as described below.\n\n\n## Optimizations\n\nThe idea of the optimizations used in `app-demo-optimized`\n(see the repo)\nis to parse the document text when the\ndocument is first opened. The resulting parse\ntree is stored as\n`model.lastAst`. Each block in the AST carries\na label `(version, id): (Int, Int)`, where\nthe `id` is unique to each block.\nEach time the text changes, a new AST is computed\nwith an incremented version number. The\nfunction `Diff.mergeWith equals` is applied to\nthe old and new ASTs\nto compute an updated AST. The updated AST\nis identical to the new AST except for the id's.\nThe id of a node in the updated AST is\nthe same as in the old AST if and only if the type, level,\nand content of the node has not changed.\nThis information is used to signal MathJax not\nto re-render mathematical text that is unchanged.\n\nTo see where these optimizations are applied,\nlook for the places in `app-demo-optimized/Main.elm`\nwhere functions in the modules\n`ParseWithId` and `Markdown.ElmWithId` are called.\n\n\n## Rendering\n\n@docs renderHtml, toHtml, renderHtmlWithTOC, renderHtmlWithExternaTOC\n\n\n## Utility\n\n@docs numberOfMathElements\n\n","unions":[],"aliases":[],"values":[{"name":"numberOfMathElements","comment":" Count the number of display math element blocks in the parse tree\n","type":"Tree.Tree Markdown.Parse.MDBlockWithId -> Basics.Int"},{"name":"renderHtml","comment":" Render a parse tree to Html.\n","type":"Markdown.Parse.Id -> Tree.Tree Markdown.Parse.MDBlockWithId -> Html.Html msg"},{"name":"renderHtmlWithExternaTOC","comment":" Like `renderHtmlWithTOC`, but transforms a parser tree into a record,\nwith fields for the document title, the table of contents, and the body\nof the document.\n","type":"Markdown.Parse.Id -> String.String -> Tree.Tree Markdown.Parse.MDBlockWithId -> { title : Html.Html msg, toc : Html.Html msg, document : Html.Html msg }"},{"name":"renderHtmlWithTOC","comment":" Like `renderHtml`, but constructs a table of contents.\n","type":"Markdown.Parse.Id -> String.String -> Tree.Tree Markdown.Parse.MDBlockWithId -> Html.Html msg"},{"name":"toHtml","comment":" Parse the input and render it to Html, e.g.,\n\ntoHtml ExtendedMath \"Pythagoras said: $a^2 + b^2 c^2$.\"\n\n","type":"Markdown.Parse.Id -> Basics.Int -> Markdown.Option.Option -> String.String -> Html.Html msg"}],"binops":[]},{"name":"Markdown.Option","comment":" The Option module defines the flavors of Markdown that can be\nparsed and rendered\n\n@docs Option\n\n","unions":[{"name":"Option","comment":" **Description:**\n\n  - Standard: vanilla Markdown\n  - Extended: strike-through text, poetry and verbatim blocks\n  - ExtendMath: like Extended, but TeX formulas are rendered\n\n","args":[],"cases":[["Standard",[]],["Extended",[]],["ExtendedMath",[]]]}],"aliases":[],"values":[],"binops":[]},{"name":"Markdown.Parse","comment":" The purpose of this module is to parse a Document,\nthat is, a string, into an abstract syntax tree (AST)\nwhich can then be further transformed or passed on\nto a rendering function. The AST is a rose tree\nof `MDBlockWithId` — short for \"Markdown Blocks.\"\n\nSee the documentation at the head of module `Markdown.ElmWithId` for\nthe rationale for this module.\n\n\n## Create or use AST\n\n@docs toMDBlockTree, searchAST, sourceMap, getLeadingTextFromAST\n\n\n## Types\n\n@docs MDBlock, MDBlockWithId, BlockContent, Id\n\n\n## Ids\n\n@docs getId, idFromString, stringFromId, idOfBlock\n\n\n## Comparison\n\n@docs equalContent, equalIds\n\n\n## Tools\n\n@docs project, projectedStringOfBlockContent, stringOfMDBlockTree\n\n","unions":[{"name":"BlockContent","comment":" The type of a parsed Block\n","args":[],"cases":[["M",["MDInline.MDInline"]],["T",["String.String"]]]},{"name":"MDBlock","comment":" An MDBlock (Markdown block) carries\n\n    - the type of the block\n    - its level\n    - its unparsed content\n\n","args":[],"cases":[["MDBlock",["BlockType.BlockType","Markdown.Parse.Level","Markdown.Parse.BlockContent"]]]},{"name":"MDBlockWithId","comment":" An MBlockWithId is like na MDBlock,\nexcept that it has an\n\n    Id : (Int, Int)\n\nwhich should be thought of as\n\n    ( version, id )\n\nwhere the id is unique to each block.\n\n","args":[],"cases":[["MDBlockWithId",["Markdown.Parse.Id","BlockType.BlockType","Markdown.Parse.Level","Markdown.Parse.BlockContent"]]]}],"aliases":[{"name":"Id","comment":" Used to generate Ids of Html elements and to\nimplement differential rendering. The first\nInt is a version number, incremented after each\nedit. The second is a an integer representing\nposition in a traversal of the tree of blocks\nobtained by parsing the text.\n","args":[],"type":"( Basics.Int, Basics.Int )"}],"values":[{"name":"equalContent","comment":" Check for equality of\n\n    - blockType\n    - level\n    - content\n\nignoring the id.\n\n","type":"Markdown.Parse.MDBlockWithId -> Markdown.Parse.MDBlockWithId -> Basics.Bool"},{"name":"equalIds","comment":" Return true of the blocks have the same id\n","type":"Markdown.Parse.MDBlockWithId -> Markdown.Parse.MDBlockWithId -> Basics.Bool"},{"name":"getId","comment":" Given a string s, return (ss, id), where ss is a string containing s\nand id a Maybe value representing the id of the corresponding element\nin the rendered text.\n","type":"String.String -> Dict.Dict String.String String.String -> ( String.String, Maybe.Maybe String.String )"},{"name":"getLeadingTextFromAST","comment":" Get lead ing text element from AST\n","type":"Tree.Tree Markdown.Parse.MDBlockWithId -> String.String"},{"name":"idFromString","comment":" Compute id from a string representation of that id, e.g..\n\n    idFromString \"i5v3\"\n    --> (5,3)\n\n","type":"String.String -> ( Basics.Int, Basics.Int )"},{"name":"idOfBlock","comment":" Return the id of a block\n","type":"Markdown.Parse.MDBlockWithId -> Markdown.Parse.Id"},{"name":"project","comment":" Project an MDBlockWithId to an MDBlock\nby omitting its id\n","type":"Markdown.Parse.MDBlockWithId -> Markdown.Parse.MDBlock"},{"name":"projectedStringOfBlockContent","comment":" Return a string representing the content of a block\nif it is of type `T`. Otherwise, return the empty string.\n","type":"Markdown.Parse.BlockContent -> String.String"},{"name":"searchAST","comment":" Search the AST for nodes whose label contains the\ngiven string, returning the Id of the first node found,\nif any.\n","type":"String.String -> Tree.Tree Markdown.Parse.MDBlockWithId -> Maybe.Maybe Markdown.Parse.Id"},{"name":"sourceMap","comment":" Create a sourceMap from the AST: a dictionary whose keys\nare text strings and whose values\nids of the corresponding elements in the DOM\n","type":"Tree.Tree Markdown.Parse.MDBlockWithId -> Dict.Dict String.String String.String"},{"name":"stringFromId","comment":" Compute a string representation of an id. Thus\n\n    stringFromId (5,3)\n    -> \"i5v3\"\n\n","type":"( Basics.Int, Basics.Int ) -> String.String"},{"name":"stringOfMDBlockTree","comment":" A string representation of an MDBlockTree. Useful\nfor verifying the validity of the AST.\n","type":"Tree.Tree Markdown.Parse.MDBlockWithId -> String.String"},{"name":"toMDBlockTree","comment":" Parse a string using a Markdown flavor option, returning the AST.\nExample:\n\n    Parse.toMDBlockTree 1 Extended \"This **is** a test.\"\n    --> Tree (MDBlockWithId (0,1)\n    -->    (MarkdownBlock Root) 0 (M (Paragraph [\n    -->       Line [OrdinaryText \"DOCUMENT\"]]))) [\n    -->          Tree (MDBlockWithId (1,1)\n    -->            (MarkdownBlock Plain) 1 (M (Paragraph [\n    -->                Line [  OrdinaryText (\"This \")\n    -->              , BoldText (\"is \")\n    -->              , OrdinaryText (\"a test.\")]\n    -->              , Line []\n    -->            ])))\n    -->      []]\n    --> : Tree.Tree Parse.MDBlockWithId\n\n","type":"Basics.Int -> Markdown.Option.Option -> Markdown.Parse.Document -> Tree.Tree Markdown.Parse.MDBlockWithId"}],"binops":[]}]