Documentation

Lean.DocString.Markdown

The internal rendering state for MarkdownM.

Instances For
    @[reducible, inline]

    The monad in which docstring Markdown is rendered. This is used when showing Verso docstrings as plain Markdown, such as in the language server.

    Instances For

      Tracks which inline delimiters are already open so that nested * / ** / […](…) don't emit redundant openers and closers.

      • inEmph : Bool

        The current code is inside emphasis (*…*).

      • inBold : Bool

        The current code is inside strong emphasis (**…**).

      Instances For

        Renders an action that produces an array of lines into a single Markdown string, appending any accumulated footnotes after the main body.

        Instances For

          Applies a uniform prefix to every line. Empty lines receive the trimmed prefix to avoid trailing whitespace (which denotes a hard line break).

          Instances For

            Applies one prefix to the first line and a different prefix to subsequent lines. Used for list items, where the first line gets "* " / "1. " and the continuation lines get " " / " ".

            Instances For

              Concatenates an array of "block" line arrays into one line array, with a single empty separator line between adjacent non-empty blocks. Empty input blocks are skipped.

              Instances For

                Concatenates a array of lines, where each line is an array of rendered inlines. The last line of one piece is glued onto the first line of the next via glueInlineBoundary (so .text "a" followed by .text "b" yields one line "ab", but two adjacent .code spans get a U+200B between them).

                Instances For
                  class Lean.Doc.ToMarkdown (α : Type u) :

                  A means of transforming values into Markdown lines.

                  • toMarkdown : αMarkdownM (Array String)

                    Render an α to its Markdown lines. The lines should not contain literal \n characters; line breaks are encoded by the array structure.

                  Instances

                    A way to transform inline elements extended with i into Markdown lines.

                    Instances
                      class Lean.Doc.MarkdownBlock (i : Type u) (b : Type v) :
                      Type (max u v)

                      A way to transform block elements extended with b (containing inline elements extended with i) into Markdown lines.

                      Instances
                        @[instance_reducible]
                        partial def Lean.Doc.partMarkdown {i : Type u_1} {b : Type u_2} {p : Type u_3} [MarkdownInline i] [MarkdownBlock i b] (level : Nat) (part : Part i b p) :

                        Renders a Part (a logical document section) at the given heading level. Headings use ATX-style (#, ##, …) with level 0 rendering as #.

                        @[instance_reducible]
                        @[reducible, inline]

                        A renderer for custom inline elements of type α. It receives a renderer for inline content, the custom element, and the element's fallback content.

                        Instances For
                          @[reducible, inline]

                          A renderer for custom block elements of type α. It receives renderers for inline and block content, the custom element, and the element's fallback content.

                          Instances For
                            @[reducible, inline]

                            Renders a custom inline element to Markdown. It receives a renderer for inline content, the saved Dynamic description of the custom element, and the element's fallback content.

                            Instances For
                              @[reducible, inline]

                              Renders a custom block element to Markdown. It receives renderers for inline and block content, the saved Dynamic description of the custom element, and the element's fallback content.

                              Instances For

                                Wraps a typed inline renderer as an InlineMdRenderer by decoding the Dynamic custom element as α.

                                Instances For

                                  Wraps a typed block renderer as a BlockMdRenderer by decoding the Dynamic custom element as α.

                                  Instances For

                                    A set of registered Markdown renderers, keyed by custom element type names.

                                    • imported : NameMap Name

                                      Renderers registered in imported modules.

                                    • current : NameMap Name

                                      Renderers registered in the current module.

                                    Instances For

                                      Registry for custom inline element renderers that maps element type names to renderer names.

                                      Registry for custom block element renderers that maps element type names to renderer names.

                                      Registers a builtin inline Markdown renderer.

                                      Instances For

                                        Registers a builtin block Markdown renderer.

                                        Instances For
                                          @[implemented_by _private.Lean.DocString.Markdown.0.Lean.Doc.inlineRendererForUnsafe]

                                          Looks up the inline Markdown renderer registered for typeName, if any.

                                          @[implemented_by _private.Lean.DocString.Markdown.0.Lean.Doc.blockRendererForUnsafe]

                                          Looks up the block Markdown renderer registered for typeName, if any.

                                          A small, fixed heartbeat budget applied afresh to each custom element renderer.

                                          Docstrings are rendered constantly (e.g. on every hover), and renderers may run arbitrary MetaM, so this bounds the work any single element can impose.

                                          Instances For

                                            Runs an element renderer with a fresh mdRendererHeartbeats budget.

                                            The budget applies to each renderer separately.

                                            Instances For

                                              Runs a renderer with a fallback.

                                              If the renderer fails or exceeds its heartbeat budget, then the fallback content is rendered instead.

                                              Instances For
                                                def Lean.Doc.runMarkdown {α : Type} (env : Environment) (act : CoreM α) (options : Options := ) (currNamespace : Name := Name.anonymous) (openDecls : List OpenDecl := []) (cancelTk? : Option IO.CancelToken := none) :
                                                IO α

                                                Runs a Markdown-rendering action against an environment, building a minimal CoreM context.

                                                Instances For
                                                  def Lean.findSimpleDocString? (env : Environment) (declName : Name) (includeBuiltin : Bool := true) (options : Options := ) (currNamespace : Name := Name.anonymous) (openDecls : List OpenDecl := []) (cancelTk? : Option IO.CancelToken := none) :

                                                  Finds a docstring without performing any alias resolution or enrichment with extra metadata. The result is rendered as Markdown.

                                                  Docstrings to be shown to a user should be looked up with Lean.findDocString? instead.

                                                  Instances For