Auxiliary function for splitAround.
Similar to String.split in Lean core, but keeps the separater.
e.g. splitAround "a,b,c" (fun c => c = ',') = ["a", ",", "b", ",", "c"]
Equations
- DocGen4.Output.splitAround s p = DocGen4.Output.splitAroundAux s p 0 0 []
Instances For
Resolve a docstring identifier reference (`Foo.bar or a .lean file path) to a URL.
Resolution order:
- If the input looks like a source file path (
*.leanwith a/), construct the corresponding source HTML page URL. - Otherwise try to decode it as a
Lean.Name. If decoding succeeds: a. Local decl match — present inname2ModIdxand non-private: emit a relative decl link. Auto-generated eliminators (Foo.rec,Foo.casesOn, …) prefer their parent type when the parent is also available. b. Local module match — present inmoduleNames: emit a relative module link. c. Similar local decl — fuzzy-match by trailing components against the current module. d. External fallback — emitexternalDeclLink name, i.e. the Mathlibfind/?pattern=…#docredirect. Both branches that previously returnednonenow route here, so cross-references to dep / Lean-core decls in docstrings become clickable. - If the input was not a decodable name and not a
.leanpath, returnnone(the caller can treat it as plain text).
See docs/dev/design/external-linking.md for the external-link policy.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- DocGen4.Output.nameToLink?.sameEnd n1 n2 = (n1.componentsRev.zip n2.componentsRev).all fun (x : Lean.Name × Lean.Name) => match x with | (a, b) => a == b
Instances For
Extend links with following rules:
- if the link starts with
##, a name search is used, and will usefindif not found - if the link starts with
#, it's treated as id link, no modification - if the link starts with
http, it's an absolute one, no modification - otherwise it's a relative link, extend it with base url
Equations
- One or more equations did not get rendered due to their size.
Instances For
Flattens an array of MD4Lean.AttrText to a plain String.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Extracts plain text from a single MD4Lean.Text, ignoring all formatting.
Equations
- DocGen4.Output.textToPlaintext (MD4Lean.Text.normal s) = s
- DocGen4.Output.textToPlaintext MD4Lean.Text.nullchar = "�"
- DocGen4.Output.textToPlaintext (MD4Lean.Text.br a) = "\n"
- DocGen4.Output.textToPlaintext (MD4Lean.Text.softbr a) = "\n"
- DocGen4.Output.textToPlaintext (MD4Lean.Text.entity s) = s
- DocGen4.Output.textToPlaintext (MD4Lean.Text.em ts) = DocGen4.Output.textsToPlaintext ts
- DocGen4.Output.textToPlaintext (MD4Lean.Text.strong ts) = DocGen4.Output.textsToPlaintext ts
- DocGen4.Output.textToPlaintext (MD4Lean.Text.u ts) = DocGen4.Output.textsToPlaintext ts
- DocGen4.Output.textToPlaintext (MD4Lean.Text.del ts) = DocGen4.Output.textsToPlaintext ts
- DocGen4.Output.textToPlaintext (MD4Lean.Text.a href title isAuto ts) = DocGen4.Output.textsToPlaintext ts
- DocGen4.Output.textToPlaintext (MD4Lean.Text.img src title alt) = DocGen4.Output.textsToPlaintext alt
- DocGen4.Output.textToPlaintext (MD4Lean.Text.code ss) = String.join ss.toList
- DocGen4.Output.textToPlaintext (MD4Lean.Text.latexMath ss) = String.join ss.toList
- DocGen4.Output.textToPlaintext (MD4Lean.Text.latexMathDisplay ss) = String.join ss.toList
- DocGen4.Output.textToPlaintext (MD4Lean.Text.wikiLink target ts) = DocGen4.Output.textsToPlaintext ts
Instances For
Extract plain text from an array of MD4Lean.Text.
Equations
- DocGen4.Output.textsToPlaintext ts = Array.foldl (fun (str : String) (t : MD4Lean.Text) => str ++ DocGen4.Output.textToPlaintext t) "" ts
Instances For
Generates an id attribute for heading elements, with the following rules:
- Characters in
letter,mark,numberandsymbolUnicode categories are preserved. - Any sequences of characters in
punctuation,separatorandothercategories are replaced by a single dash. - Cases (upper and lower) are preserved.
Equations
Instances For
Equations
Instances For
Equations
- DocGen4.Output.mdGetHeadingId.replaceCharSeq pattern replacement s = replacement.intercalate (List.filter (fun (x : String) => !x.isEmpty) (s.splitToList pattern))
Instances For
Equations
Instances For
Checks whether a fenced code block language allows auto-linking.
Equations
- DocGen4.Output.isLeanCode lang = ((DocGen4.Output.attrTextToString lang).isEmpty || DocGen4.Output.attrTextToString lang == "lean")
Instances For
Equations
Instances For
Renders a single MD4Lean.Text inline element to HTML, while processing custom extensions such as
bibliography items. inLink suppresses auto-linking inside <a> to avoid nested anchors.
Render an array of MD4Lean.Text inline elements to HTML.
Render a single MD4Lean.Block element to HTML.
Render a list item to HTML.
Find all references in a markdown text.
Convert docstring to Html.
Equations
- One or more equations did not get rendered due to their size.