Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions docs/guide/custom-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ MyCustomPlugin.implementedFunctions = {
};
```

::: tip To define multiple functions in a single function plugin, add them all
::: tip
To define multiple functions in a single function plugin, add them all
to the `implementedFunctions` object.

```js
Expand All @@ -64,7 +65,6 @@ MyCustomPlugin.implementedFunctions = {
},
};
```

:::

### 3. Add your function's names
Expand Down Expand Up @@ -302,9 +302,11 @@ if (rangeData.some((row) => row.some((val) => typeof rawValue !== 'number'))) {
}
```

::: tip All HyperFormula [error types](types-of-errors.md) support optional
::: tip
All HyperFormula [error types](types-of-errors.md) support optional
custom error messages. Put them to good use: let your users know what caused the
error and how to avoid it in the future. :::
error and how to avoid it in the future.
:::

### Test your function

Expand Down Expand Up @@ -476,8 +478,10 @@ function's behavior depends on the number of valid arguments passed), use the
You can add translations of your function's name in multiple languages. Your end
users use the translated names to call your function inside formulas.

::: tip If you support just one language, you still need to define the name of
your function in that language. :::
::: tip
If you support just one language, you still need to define the name of
your function in that language.
:::

In a separate object, define the translations of your custom functions' names in
every language you want to support. Function names are case-insensitive, as they
Expand All @@ -500,8 +504,10 @@ export const MyCustomPluginTranslations = {
HyperFormula.registerFunctionPlugin(MyCustomPlugin, MyCustomPluginTranslations);
```

::: tip Before using a translated function name, remember to
[register and set the language](localizing-functions.md). :::
::: tip
Before using a translated function name, remember to
[register and set the language](localizing-functions.md).
:::

## Function aliases

Expand All @@ -517,7 +523,8 @@ MyCustomPlugin.aliases = {
};
```

::: tip For each alias of your function, define a translation, even if you want
::: tip
For each alias of your function, define a translation, even if you want
to support only one language.

```js
Expand All @@ -528,5 +535,4 @@ MyCustomPlugin.translations = {
},
};
```

:::
2 changes: 0 additions & 2 deletions docs/guide/named-expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Expression names are case-insensitive, and they:
- Must be unique within a given scope.

::: tip

Expression names must be unique within a given scope, but you can override a
global named-expression with a local one. For example:

Expand All @@ -56,7 +55,6 @@ hfInstance.addNamedExpression('MyRevenue', '=SUM(100+10)');
// but you can still use `MyRevenue` within the local scope of Sheet2 (sheetId = 1)
hfInstance.addNamedExpression('MyRevenue', '=Sheet2!$A$1+100', 1);
```

:::

For examples of valid and invalid expression names, see the following table:
Expand Down