Skip to content

mcanouil/quarto-div-reuse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Div-reuse Extension For Quarto

This is a Quarto extension applying the concept of "code reuse" to the content of a Markdown fenced div.

Installing

quarto add mcanouil/quarto-div-reuse

This will install the extension under the _extensions subdirectory. If you're using version control, you will want to check in this directory.

Using

To use the extension, add the following to your document's front matter:

filters:
  - div-reuse

If you plan to reuse content processed by Quarto, such as cross-referenced content, make sure the filter is applied last.

filters:
  - quarto
  - div-reuse

Then, you can reuse any fenced div by using their ID in the following way:

## Original Div

::: {#my-div}
{{< lipsum >}}
:::

## Reused Div

::: {reuse="my-div"}
:::

Important

The "reuse" attribute acts like a copy-paste of the original div content. Consequently, content and their attributes, including the ID, are duplicated. This can result in unexpected behaviour if the same ID is used multiple times within the same document.

Therefore, it is recommended to use the "reuse" attribute primarily with text content.

Example

Here is the source code for a minimal example: example.qmd.

Outputs of example.qmd:

About

The power of "code/content reuse" for seamless and efficient content creation.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Contributors 2

  •  
  •  

Languages