Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quarto Callout Blocks support #267

Open
dmetivie opened this issue Jan 8, 2025 · 2 comments
Open

Quarto Callout Blocks support #267

dmetivie opened this issue Jan 8, 2025 · 2 comments

Comments

@dmetivie
Copy link

dmetivie commented Jan 8, 2025

It seems that Quarto format for callout blocks is different that usual markdown flavor, see here.

Example instead of

!!! note
   My note

It is with Quarto

::: {.callout-note}
My note
:::

Currently, using Literate.jl with Quarto flavor on

# !!! note
#     My note

produces in the qmd

> **Note**
>
> My note

Which is not exactly the intended result.

It would be nice to support all the callout blocks (note, warning etc) !

@fredrikekre
Copy link
Owner

See #259

@dmetivie
Copy link
Author

Ok!
I am no regex expert but (using your code) does the following would be acceptable

adm_to_QuartoCallout = function (s)
    m = match(r, s)::RegexMatch
    io = IOBuffer()
    print(io, "::: {.callout-") # to open the callout
    print(io, string(m[:type]))
    println(io, "}") # not sure how to detect the Quarto `collapse` option if any
    if (title = m[:title]; title !== nothing)
        print(io, "## ")
        print(io, title)
    end
    for l in eachline(IOBuffer(m[:lines]); keep = true)
        print(io, replace(l, r"^#     " => ""))
    end
    print("\n :::") # to close the callout
    return String(take!(io))
end

with a isQuartoFlavor option somewhere ? Or another kwarg to select the type of admonitions wanted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants