From c6399a6dc8f10abf8ba3f62ba4270156fae9387e Mon Sep 17 00:00:00 2001 From: Danny Gleckler Date: Fri, 23 Aug 2024 09:53:48 -0400 Subject: [PATCH] Add advanced formatting docs --- README.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index df00520..97f06d5 100644 --- a/README.md +++ b/README.md @@ -340,15 +340,31 @@ Similarly `` *emphasizes* a particular piece of text (browsers show this vis Example: -```json +```javascript +{ + myMessage: "This is bold but not all that important." +} +``` + +#### Advanced Formatting + +More advanced formatting can be achieved by providing replacement methods for custom tags, which are similar to arguments: + +```javascript { - "myMessage": "This is bold but not all that important." + goHome: "Go home" } ``` ```javascript -localizer.localizeHTML('myMessage'); +localizer.localizeHTML('goHome', { + homeLink: chunks => `${chunks}` +}); ``` +In addition to the Basic Formatting elements, these additional elements may also be used in replacement methods: + +* `` +* `` ### `onResourcesChange` Provide an `onResourcesChange` callback function to perform tasks when the document language is changed and updated resources are available: