aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--_extention.qmd56
1 files changed, 56 insertions, 0 deletions
diff --git a/_extention.qmd b/_extention.qmd
new file mode 100644
index 0000000..4fbb66f
--- /dev/null
+++ b/_extention.qmd
@@ -0,0 +1,56 @@
+
+# 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)
+ if el.text:find("Leandre") then
+ el.text = el.text:gsub("Leandre", "Léandre")
+ end
+ return el
+end
+```
+What do this small code do is searching for the string "Leandre" and when it find it. It will replace it with the string "Léandre"
+
+# More resources
+
+In this link 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) \ No newline at end of file