diff options
| author | Jonas Smedegaard <dr@jones.dk> | 2025-03-16 18:23:55 +0100 |
|---|---|---|
| committer | Jonas Smedegaard <dr@jones.dk> | 2025-03-16 18:24:30 +0100 |
| commit | dbb50bc03105bd7a208e46a9b0ddbe11811b8f20 (patch) | |
| tree | b111743996988ce77fa569540e60428487286c19 /_extention.qmd | |
| parent | 8e703f77bb2431902ebd57aced3fba1224e28c44 (diff) | |
drop draft extensions by Léandre and Sabin
Diffstat (limited to '_extention.qmd')
| -rw-r--r-- | _extention.qmd | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/_extention.qmd b/_extention.qmd deleted file mode 100644 index 9918cf9..0000000 --- a/_extention.qmd +++ /dev/null @@ -1,60 +0,0 @@ - -# Introduction - -In this file we will see how to create an filter extention for quarto using Lua. -A filter extention is a flexible and powerful tool for introducing new global behaviors and/or new markdown rendering behaviors. -For example, you could create filters to implement output folding, an image carousel, or just about anything you can imagine! - -# Creation - -To create a extention we need to have an "_extensions" folder -and in this folder we need to create a folder for each extention. -For each extention we need to have a file name "_extension.yml" to tell quarto the structure of this extention. -Here is an exemple: -```yaml -title: Leandre Name Filter -author: Léandre -version: 1.0.0 -quarto-required: ">=1.3.0" -contributes: - filters: - - leandre.lua -``` -In this file we can see that it include a file in .lua and that where the logic of the extention will be coded. - -So in resume we have this file structure -```bash -_extensions/ -└── leandre-filter - ├── _extension.yml - └── leandre.lua -``` - -# Code Exemple - -For this exemple we will talk about the file leandre.lua -```lua -function Str(el) - el.text = el.text:gsub("[Ll][Ee][Aa][Nn][Dd][Rr][Ee]", "Léandre") - return el -end -``` -What do this small code do is using the function gsub for each part of the document. -The gsub function search for a patern and replace it with the given string. -The patern given here "[Ll][Ee][Aa][Nn][Dd][Rr][Ee]" to permit to have evry possibility covered of the word léandre. - - -# More resources - -In these links you can find more information about the diferent function that can be use in the extention. - -[https://quarto.org/docs/extensions/lua.html](https://quarto.org/docs/extensions/lua.html) - - -[https://quarto.org/docs/extensions/lua-api.html](https://quarto.org/docs/extensions/lua-api.html) - -More about filter -[https://quarto.org/docs/extensions/filters.html](https://quarto.org/docs/extensions/filters.html) - -And other type of extension -[https://quarto.org/docs/extensions/creating.html#development](https://quarto.org/docs/extensions/creating.html#development) |
