Skip to content

Improvement Proposal: Quadruple Backticks for @example Codefences in (Documenter-)Markdown #144

@manuelbb-upb

Description

@manuelbb-upb

I am testing Literate for writing a module where some functions have docstrings attached.
I noticed that if I am including code-examples or math in the docstrings, then the resulting Code-Blocks in markdown output get split.

Example: The Julia Code

"""
Doc String with math:
```math
    π = 3
```
"""
function funny_fun(x) nothing end

will result in Markdown that looks something like

```@example
"""
Doc String with math:
```

and

math
    π = 3
```@example
```
"""
function funny_fun(x) nothing end

This of course can break the whole document.
A simple fix is to provide the codefence keyword argument to Literate.markown, specifying to use 4 consecutive backticks instead of 3, i.e.,

codefence = "````@example SomeName" => "````"

I am thinking that maybe this should be the default behavior, at least for documenter output?
Anyways, thanks for the great work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions