[{"name":"Markdown.Option","comment":" The Option module defines the flavors of Markdown that can be\nparsed and rendered\n\n@docs MarkdownOption, OutputOption\n\n","unions":[{"name":"MarkdownOption","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",[]]]},{"name":"OutputOption","comment":" Options for Markdown output:\n\n    - Basic: the usual\n    - InternalTOC: table of contents at top of document\n    - ExternalTOC: table of contents in another window\n\n","args":[],"cases":[["Basic",[]],["InternalTOC",["String.String"]],["ExternalTOC",["String.String"]]]}],"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 -> BiDict.BiDict 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 -> BiDict.BiDict 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.MarkdownOption -> Markdown.Parse.Document -> Tree.Tree Markdown.Parse.MDBlockWithId"}],"binops":[]},{"name":"Markdown.Render","comment":"\n\n\n## Simple Applications\n\nWhen there is no interaction between the Markdown text and and an\non-the-fly editor, use the `withSimpleOptions` function:\n\n    withSimpleOptions :\n        MarkdownOption\n        -> OutputOption\n        -> String\n        -> MarkdownOutput\n\nFor example:\n\n    withSimpleOptions Extended Basic \"This is *italic text.*\"\n        |> content\n        |> Html.map MarkdownMsg\n\nwhere one has\n\n    import Markdown.Render exposing(withSimpleOptions, MarkdownMsg(..))\n    import Markdown.Options expsosing(..)\n\n    type Msg = MarkdownMsg MarkdownMsg | ...\n\n\n## Editor interaction\n\nUse the `withOptions` and `withOptionsFromAST` functions if you need\nmore control over the editing process (see the `./Editor` folder\nfor examples).\n\nThe function `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\nThis library\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## Types\n\n@docs MarkdownMsg, MarkdownOutput, DocumentParts\n\n\n## Rendering\n\n@docs toHtml, withOptions, withOptionsFromAST, withSimpleOptions\n\n\n## Extracting content from a MarkdownOutput value\n\n@docs content, title, toc\n\n\n## Utility\n\n@docs renderHtml, toHtmlWithId, numberOfMathElements\n\n","unions":[{"name":"MarkdownMsg","comment":" Use `Html MarkdownMsg` so that user clicks on elements in the rendered text can be detected.\n","args":[],"cases":[["IDClicked",["String.String"]]]},{"name":"MarkdownOutput","comment":" The kinds of Markdown output\n","args":[],"cases":[["Simple",["Html.Html Markdown.Render.MarkdownMsg"]],["Composite",["Markdown.Render.DocumentParts"]]]}],"aliases":[{"name":"DocumentParts","comment":" The type of a composite document\n","args":[],"type":"{ title : Html.Html Markdown.Render.MarkdownMsg, toc : Html.Html Markdown.Render.MarkdownMsg, document : Html.Html Markdown.Render.MarkdownMsg }"}],"values":[{"name":"content","comment":" Extract the content from a MarkdownOutput value\n","type":"Markdown.Render.MarkdownOutput -> Html.Html Markdown.Render.MarkdownMsg"},{"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 Markdown.Render.MarkdownMsg"},{"name":"title","comment":" Extract the title from a MarkdownOutput value\n","type":"Markdown.Render.MarkdownOutput -> Html.Html Markdown.Render.MarkdownMsg"},{"name":"toHtml","comment":" Parse the input and render it to Html, e.g.,\n\n    toHtml ExtendedMath \"Pythagoras said: $a^2 + b^2 c^2$.\"\n\n","type":"Markdown.Option.MarkdownOption -> String.String -> Html.Html Markdown.Render.MarkdownMsg"},{"name":"toHtmlWithId","comment":" Parse the input and render it to Html, e.g.,\n\n    toHtmlWithId ( 0, 0 ) 0 ExtendedMath \"Pythagoras said: $a^2 + b^2 c^2$.\"\n\n","type":"Markdown.Parse.Id -> Basics.Int -> Markdown.Option.MarkdownOption -> String.String -> Html.Html Markdown.Render.MarkdownMsg"},{"name":"toc","comment":" Extract the table of contents from a MarkdownOutput value\n","type":"Markdown.Render.MarkdownOutput -> Html.Html Markdown.Render.MarkdownMsg"},{"name":"withOptions","comment":" Render source text\n","type":"Markdown.Option.MarkdownOption -> Markdown.Option.OutputOption -> Markdown.Parse.Id -> Basics.Int -> String.String -> Markdown.Render.MarkdownOutput"},{"name":"withOptionsFromAST","comment":" Render from an AST\n","type":"Markdown.Option.MarkdownOption -> Markdown.Option.OutputOption -> Markdown.Parse.Id -> Tree.Tree Markdown.Parse.MDBlockWithId -> Markdown.Render.MarkdownOutput"},{"name":"withSimpleOptions","comment":" Render source text with simplified opptions\n","type":"Markdown.Option.MarkdownOption -> Markdown.Option.OutputOption -> String.String -> Markdown.Render.MarkdownOutput"}],"binops":[]}]