chore: Linting for markdown and js
This commit is contained in:
parent
eca8199ed8
commit
1c92e0f655
6677 changed files with 24391 additions and 25987 deletions
|
@ -1,7 +1,8 @@
|
|||
---
|
||||
***
|
||||
|
||||
title: Using hooks
|
||||
order: 70
|
||||
---
|
||||
---------
|
||||
|
||||
For each hook, your plugin should provide a method that takes the relevant data
|
||||
as its first argument. If data was passed when the hook was loaded, you will receive
|
||||
|
@ -9,8 +10,8 @@ that as the second object.
|
|||
|
||||
Remember that:
|
||||
|
||||
- The `insertText` hook will receive a locale and string and you should return a string.
|
||||
- All other hooks receive an object. You don't need to return anything, but rather modify the object you receive.
|
||||
* The `insertText` hook will receive a locale and string and you should return a string.
|
||||
* All other hooks receive an object. You don't need to return anything, but rather modify the object you receive.
|
||||
|
||||
Let's look at an example:
|
||||
|
||||
|
@ -39,8 +40,8 @@ export default {
|
|||
|
||||
This is a complete plugin, ready to be published on NPM. It uses two hooks:
|
||||
|
||||
- `preRender` : We add some style and defs to our SVG
|
||||
- `insertText` : We transfer all text to UPPERCASE
|
||||
* `preRender` : We add some style and defs to our SVG
|
||||
* `insertText` : We transfer all text to UPPERCASE
|
||||
|
||||
<Note>
|
||||
|
||||
|
@ -52,8 +53,7 @@ the SVG tag with the name and version of our plugin.
|
|||
We check for this attribute when the `preRender` hook runs, thereby avoiding that
|
||||
our styles and defs will be added twice.
|
||||
|
||||
It is good practice to wrap you hook methods in a call like this, because you have
|
||||
It is good practice to wrap you hook methods in a call like this, because you have
|
||||
no guarantee the user won't render your pattern more than once.
|
||||
|
||||
</Note>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue