Skip to content

Can you capture a code block's content in a shortcode? #12754

Answered by zachcp
zachcp asked this question in Q&A
Discussion options

You must be logged in to vote

As per @mcanouil above the basics of what I want are the following. Note this is a filter.

    ```{.json .livemol}.             //  <--- note the `.livemol` tag
    {name:  "zach"} 
    ```
-- _extensions/livemol/livemol.lua
function CodeBlock(el)
    if el.classes and el.classes:includes("livemol") then.    --  <--- process blocks with this tag
        ....
    end
end

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@zachcp
Comment options

@mcanouil
Comment options

@zachcp
Comment options

Comment options

You must be logged in to vote
1 reply
@mcanouil
Comment options

Answer selected by zachcp
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
extensions relates to Quarto extensions mechanism lua Issues related to the lua codebase, filter chain, etc
2 participants