@intlayer/docs 8.10.0-canary.0 → 8.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,64 +19,63 @@ slugs:
19
19
  history:
20
20
  - version: 8.10.0
21
21
  date: 2026-05-19
22
- changes: "Add `.content.md` files support"
22
+ changes: "Added support for `.content.md` files"
23
23
  - version: 8.5.0
24
24
  date: 2026-03-24
25
- changes: "Add `intlayerMarkdown` plugin object; use `app.use(intlayerMarkdown)` instead of `app.use(installIntlayerMarkdown)`"
25
+ changes: "Added `intlayerMarkdown` plugin object; use `app.use(intlayerMarkdown)` instead of `app.use(installIntlayerMarkdown)`"
26
26
  - version: 8.5.0
27
27
  date: 2026-03-24
28
- changes: "move import from `{{framework}}-intlayer` to `{{framework}}-intlayer/markdown`"
28
+ changes: "Moved import from `{{framework}}-intlayer` to `{{framework}}-intlayer/markdown`"
29
29
  - version: 8.0.0
30
30
  date: 2026-01-22
31
- changes: "Add MarkdownRenderer / useMarkdownRenderer / renderMarkdown utility and forceInline option"
31
+ changes: "Added MarkdownRenderer / useMarkdownRenderer / renderMarkdown utility and forceInline option"
32
32
  - version: 8.0.0
33
33
  date: 2026-01-18
34
34
  changes: "Automatic decoration of markdown content, MDX and SSR support"
35
35
  - version: 5.5.10
36
36
  date: 2025-06-29
37
- changes: "Init history"
37
+ changes: "Initialised history"
38
38
  ---
39
39
 
40
40
  # Markdown / Rich Text Content
41
41
 
42
- Intlayer supports rich text content defined using Markdown syntax. This allows you to easily write and maintain content with rich formatting, such as blogs, articles, and more.
42
+ Intlayer supports rich text content defined using Markdown syntax. This allows you to easily write and maintain richly-formatted content like blogs, articles, and more.
43
43
 
44
- ## Part 1: Declaring Markdown Content
44
+ ## Declaring Markdown Content
45
45
 
46
46
  You can declare Markdown content using the `md` function or simply as a string (if it contains Markdown syntax).
47
47
 
48
48
  <Tabs>
49
49
  <Tab label=".content.md" value=".content.md">
50
- Since version `8.10.0`, you can declare Markdown content directly in `.content.md` files. Intlayer will
51
- automatically detect and parse the Markdown content.
50
+ Starting from version `8.10.0`, you can declare Markdown content directly in `.content.md` files. Intlayer will automatically detect and parse the Markdown content.
52
51
 
53
- ```md fileName="markdown-file.en.content.md"
52
+ ```md fileName="markdown-file.en-GB.content.md"
54
53
  ---
55
54
  key: my-markdown-content
56
55
  description: My content
57
- locale: en
56
+ locale: en-GB
58
57
  ---
59
58
 
60
59
  # My content
61
60
 
62
- Here an example of markdown content
61
+ Here is a markdown content example
63
62
  ```
64
63
 
65
- The `locale` frontmatter field is the field that define the locale of the content. It is optional. If not provided, Intlayer will use the default locale, which is also used as fallback locale if no translation is available for a specific locale.
64
+ The `locale` front-matter field is the field that defines the content locale. It is optional. If not provided, Intlayer will use the default locale, which is also used as a fallback locale if no translation is available for a specific locale.
66
65
 
67
- Example of file structure:
66
+ Files structure example:
68
67
 
69
68
  ```text
70
69
  content/
71
- ├── en/
72
- │ └── markdown-file.en.content.md
70
+ ├── en-GB/
71
+ │ └── markdown-file.en-GB.content.md
73
72
  ├── fr/
74
73
  │ └── markdown-file.fr.content.md
75
74
  └── es/
76
75
  └── markdown-file.es.content.md
77
76
  ```
78
77
 
79
- You can add in front-matter any properties defined in the [Dictionary definition](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/dictionary/content_file.md)
78
+ You can add in the front-matter any properties defined in the [Dictionary Definition](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/dictionary/content_file.md)
80
79
 
81
80
  </Tab>
82
81
  <Tab label="Manual Wrapping" value="manual-wrapping">
@@ -96,33 +95,34 @@ You can declare Markdown content using the `md` function or simply as a string (
96
95
  ```
97
96
 
98
97
  </Tab>
99
- <Tab label="Automatic Detection" value="automatic-detection">
100
- If the string contains common Markdown indicators (like headers, lists, links, etc.), Intlayer will automatically transform it.
98
+ <Tab label="External Files" value="external-files">
99
+ Import `.md` files directly using the `file` function.
101
100
 
102
101
  ```typescript fileName="markdownDictionary.content.ts"
102
+ import { md, file, t } from "intlayer";
103
+
103
104
  export default {
104
105
  key: "app",
105
- contentAutoTransformation: true, // Enable automatic detection of Markdown content - Can be set globally in intlayer.config.ts
106
106
  content: {
107
- myMarkdownContent: "## My title \n\nLorem Ipsum",
107
+ content: t({
108
+ en: md(file("./myMarkdown.en-GB.md")),
109
+ fr: md(file("./myMarkdown.fr.md")),
110
+ }),
108
111
  },
109
112
  };
110
113
  ```
111
114
 
112
115
  </Tab>
113
- <Tab label="External Files">
114
- Import `.md` files directly using the `file` function.
115
116
 
116
- ```typescript fileName="markdownDictionary.content.ts"
117
- import { md, file, t } from "intlayer";
117
+ <Tab label="Automatic Detection" value="automatic-detection">
118
+ If the string contains common Markdown indicators (like headings, lists, links, etc.), Intlayer will automatically transform it.
118
119
 
120
+ ```typescript fileName="markdownDictionary.content.ts"
119
121
  export default {
120
122
  key: "app",
123
+ contentAutoTransformation: true, // Enable automatic detection of Markdown content - Can be set globally in intlayer.config.ts
121
124
  content: {
122
- content: t({
123
- en: md(file("./myMarkdown.en.md")),
124
- fr: md(file("./myMarkdown.fr.md")),
125
- }),
125
+ myMarkdownContent: "## My title \n\nLorem Ipsum",
126
126
  },
127
127
  };
128
128
  ```
@@ -134,11 +134,17 @@ You can declare Markdown content using the `md` function or simply as a string (
134
134
 
135
135
  ## Rendering Markdown
136
136
 
137
- Rendering can be handled automatically by Intlayer's content system or manually using specialised tools.
137
+ Intlayer provides two independent ways to render Markdown:
138
+
139
+ 1. **Via `useIntlayer`**
140
+ — Intlayer automatically transforms the `md` node into the framework's native output (JSX, VNode, HTML string).
141
+ - Frontmatter is parsed and exposed as `.metadata`. You can override the rendering at two levels — globally with `MarkdownProvider` (or framework equivalent) and locally per node with `.use()`. Both can be combined; `.use()` takes precedence over `MarkdownProvider`, which takes precedence over the default.
142
+
143
+ 2. **Helper utilities** — `<MarkdownRenderer />`, `useMarkdownRenderer()`, and `renderMarkdown()` are standalone tools that accept **only raw Markdown strings**. They are independent of `useIntlayer` and do not work with the decorated nodes it returns.
138
144
 
139
- ### 1. Automatic Rendering (using `useIntlayer`)
145
+ Markdown rendering supports **MDX** use any JSX/framework component by name directly inside your Markdown.
140
146
 
141
- When you access content via `useIntlayer`, Markdown nodes are already prepared for rendering.
147
+ ### 1. Automatic Rendering (via `useIntlayer`)
142
148
 
143
149
  <Tabs group="framework">
144
150
  <Tab label="React / Next.js" value="react">
@@ -146,24 +152,54 @@ When you access content via `useIntlayer`, Markdown nodes are already prepared f
146
152
 
147
153
  ```tsx fileName="App.tsx"
148
154
  import { useIntlayer } from "react-intlayer";
155
+ import { MarkdownProvider } from "react-intlayer/markdown";
149
156
 
150
157
  const AppContent = () => {
151
158
  const { myMarkdownContent } = useIntlayer("app");
159
+
152
160
  return <div>{myMarkdownContent}</div>;
153
161
  };
162
+
163
+ const App = () => (
164
+ <MarkdownProvider
165
+ components={{
166
+ h1: ({ children }) => <h1 style={{ color: "red" }}>{children}</h1>,
167
+ MyButton: (props) => <button {...props} />, // MDX Component
168
+ }}
169
+ >
170
+ <AppContent />
171
+ </MarkdownProvider>
172
+ );
154
173
  ```
155
174
 
175
+ > If `MarkdownProvider` is not present, Intlayer will render the markdown using the default Markdown to JSX parser.
176
+
156
177
  You can also provide local overrides for specific nodes using the `.use()` method:
157
178
 
158
179
  ```tsx
159
180
  {myMarkdownContent.use({
160
- h1: ({ children }) => <h1 className="text-3xl font-bold">{children}</h1>,
181
+ h1: ({ children }) => <h1 style={{ color: "red" }}>{children}</h1>,
161
182
  })}
162
183
  ```
163
184
 
185
+ You can retrieve the Markdown as a string:
186
+
187
+ ```tsx
188
+ {myMarkdownContent.value}
189
+ {String(myMarkdownContent)}
190
+ {myMarkdownContent.toString()}
191
+ ```
192
+
193
+ And you can access your markdown metadata like this:
194
+
195
+ ```tsx
196
+ {myMarkdownContent.metadata}
197
+ {myMarkdownContent.metadata.title}
198
+ ```
199
+
164
200
  </Tab>
165
- <Tab label="Vue">
166
- In Vue, Markdown content can be rendered using the `component` built-in or directly as a node.
201
+ <Tab label="Vue" value="vue">
202
+ In Vue, Markdown content can be rendered using the built-in `component` tag or directly as a node.
167
203
 
168
204
  ```vue fileName="App.vue"
169
205
  <script setup>
@@ -176,43 +212,183 @@ When you access content via `useIntlayer`, Markdown nodes are already prepared f
176
212
  </template>
177
213
  ```
178
214
 
215
+ Configure globally via the `intlayerMarkdown` plugin (supports MDX custom components):
216
+
217
+ ```ts fileName="main.ts"
218
+ import { intlayerMarkdown } from "vue-intlayer/markdown";
219
+
220
+ app.use(intlayerMarkdown, {
221
+ components: {
222
+ h1: (props) => h('h1', { style: { color: 'green' } }, props.children),
223
+ MyButton: (props) => h('button', props), // MDX Component
224
+ },
225
+ });
226
+ ```
227
+
228
+ > If the `intlayerMarkdown` plugin is not installed, Intlayer will render using the default compiler.
229
+
230
+ You can also provide local overrides for specific nodes using the `.use()` method:
231
+
232
+ ```vue
233
+ <component :is="myMarkdownContent.use({
234
+ h1: (props) => h('h1', { style: { color: 'red' } }, props.children),
235
+ })" />
236
+ ```
237
+
238
+ You can retrieve the Markdown as a string:
239
+
240
+ ```vue
241
+ {{ myMarkdownContent.value }}
242
+ {{ String(myMarkdownContent) }}
243
+ {{ myMarkdownContent.toString() }}
244
+ ```
245
+
246
+ And you can access your markdown metadata like this:
247
+
248
+ ```vue
249
+ <component :is="myMarkdownContent.metadata" />
250
+ <component :is="myMarkdownContent.metadata.title" />
251
+ ```
252
+
179
253
  </Tab>
180
254
  <Tab label="Svelte" value="svelte">
181
255
  Svelte renders Markdown as an HTML string by default. Use `{@html}` to render it.
182
256
 
183
- ```svelte
257
+ ```svelte fileName="App.svelte"
184
258
  <script lang="ts">
185
259
  import { useIntlayer } from "svelte-intlayer";
260
+ import { MarkdownProvider } from "svelte-intlayer/markdown";
261
+ import MyHeading from "./MyHeading.svelte";
262
+
186
263
  const content = useIntlayer("app");
187
264
  </script>
188
265
 
189
- {@html $content.myMarkdownContent}
266
+ <MarkdownProvider components={{ h1: MyHeading }}>
267
+ {@html $content.myMarkdownContent}
268
+ </MarkdownProvider>
269
+ ```
270
+
271
+ > If `MarkdownProvider` is not present, Intlayer will render the markdown using the default compiler.
272
+
273
+ You can also provide local overrides for specific nodes using the `.use()` method:
274
+
275
+ ```svelte
276
+ {@html $content.myMarkdownContent.use({ ... })}
277
+ ```
278
+
279
+ You can retrieve the Markdown as a string:
280
+
281
+ ```svelte
282
+ {$content.myMarkdownContent.value}
283
+ {String($content.myMarkdownContent)}
284
+ {$content.myMarkdownContent.toString()}
285
+ ```
286
+
287
+ And you can access your markdown metadata like this:
288
+
289
+ ```svelte
290
+ {$content.myMarkdownContent.metadata}
291
+ {$content.myMarkdownContent.metadata.title}
190
292
  ```
191
293
 
192
294
  </Tab>
193
295
  <Tab label="Preact" value="preact">
194
- Preact supports Markdown nodes directly in the JSX.
296
+ Preact supports Markdown nodes directly in JSX.
195
297
 
196
298
  ```tsx fileName="App.tsx"
197
299
  import { useIntlayer } from "preact-intlayer";
300
+ import { MarkdownProvider } from "preact-intlayer/markdown";
198
301
 
199
302
  const AppContent = () => {
200
303
  const { myMarkdownContent } = useIntlayer("app");
201
304
  return <div>{myMarkdownContent}</div>;
202
305
  };
306
+
307
+ const App = () => (
308
+ <MarkdownProvider
309
+ components={{
310
+ h1: ({ children }) => <h1 style={{ color: "red" }}>{children}</h1>,
311
+ MyButton: (props) => <button {...props} />, // MDX Component
312
+ }}
313
+ >
314
+ <AppContent />
315
+ </MarkdownProvider>
316
+ );
317
+ ```
318
+
319
+ > If `MarkdownProvider` is not present, Intlayer will render the markdown using the default Markdown to JSX parser.
320
+
321
+ You can also provide local overrides for specific nodes using the `.use()` method:
322
+
323
+ ```tsx
324
+ {myMarkdownContent.use({
325
+ h1: ({ children }) => <h1 style={{ color: "red" }}>{children}</h1>,
326
+ })}
327
+ ```
328
+
329
+ You can retrieve the Markdown as a string:
330
+
331
+ ```tsx
332
+ {myMarkdownContent.value}
333
+ {String(myMarkdownContent)}
334
+ {myMarkdownContent.toString()}
335
+ ```
336
+
337
+ And you can access your markdown metadata like this:
338
+
339
+ ```tsx
340
+ {myMarkdownContent.metadata}
341
+ {myMarkdownContent.metadata.title}
203
342
  ```
204
343
 
205
344
  </Tab>
206
345
  <Tab label="Solid" value="solid">
207
- Solid supports Markdown nodes directly in the JSX.
346
+ Solid supports Markdown nodes directly in JSX.
208
347
 
209
348
  ```tsx fileName="App.tsx"
210
349
  import { useIntlayer } from "solid-intlayer";
350
+ import { MarkdownProvider } from "solid-intlayer/markdown";
211
351
 
212
352
  const AppContent = () => {
213
353
  const { myMarkdownContent } = useIntlayer("app");
214
354
  return <div>{myMarkdownContent}</div>;
215
355
  };
356
+
357
+ const App = () => (
358
+ <MarkdownProvider
359
+ components={{
360
+ h1: (props) => <h1 style={{ color: "red" }}>{props.children}</h1>,
361
+ MyButton: (props) => <button {...props} />, // MDX Component
362
+ }}
363
+ >
364
+ <AppContent />
365
+ </MarkdownProvider>
366
+ );
367
+ ```
368
+
369
+ > If `MarkdownProvider` is not present, Intlayer will render the markdown using the default Markdown to JSX parser.
370
+
371
+ You can also provide local overrides for specific nodes using the `.use()` method:
372
+
373
+ ```tsx
374
+ {myMarkdownContent.use({
375
+ h1: (props) => <h1 style={{ color: "red" }}>{props.children}</h1>,
376
+ })}
377
+ ```
378
+
379
+ You can retrieve the Markdown as a string:
380
+
381
+ ```tsx
382
+ {myMarkdownContent.value}
383
+ {String(myMarkdownContent)}
384
+ {myMarkdownContent.toString()}
385
+ ```
386
+
387
+ And you can access your markdown metadata like this:
388
+
389
+ ```tsx
390
+ {myMarkdownContent.metadata}
391
+ {myMarkdownContent.metadata.title}
216
392
  ```
217
393
 
218
394
  </Tab>
@@ -232,6 +408,8 @@ When you access content via `useIntlayer`, Markdown nodes are already prepared f
232
408
  }
233
409
  ```
234
410
 
411
+ > If the IntlayerMarkdown provider is not configured, Intlayer will render using the default compiler.
412
+
235
413
  You can also provide local overrides for specific nodes using the `.use()` method:
236
414
 
237
415
  ```typescript
@@ -240,19 +418,34 @@ When you access content via `useIntlayer`, Markdown nodes are already prepared f
240
418
  })
241
419
  ```
242
420
 
421
+ You can retrieve the Markdown as a string:
422
+
423
+ ```typescript
424
+ content().myMarkdownContent.value
425
+ String(content().myMarkdownContent)
426
+ content().myMarkdownContent.toString()
427
+ ```
428
+
429
+ And you can access your markdown metadata like this:
430
+
431
+ ```typescript
432
+ content().myMarkdownContent.metadata
433
+ content().myMarkdownContent.metadata.title
434
+ ```
435
+
243
436
  </Tab>
244
437
  </Tabs>
245
438
 
246
- ### 2. Manual Rendering & Advanced Tools
439
+ ### 2. Helper Utilities (Markdown Strings Only)
247
440
 
248
- If you need to render raw Markdown strings or have more control over the rendering process, use the following tools.
441
+ These utilities render **only raw Markdown strings** and are independent of `useIntlayer`. Use them when you need to render Markdown from sources other than your dictionaries.
249
442
 
250
443
  <Tabs group="framework">
251
444
  <Tab label="React / Next.js" value="react">
252
445
 
253
446
  #### `<MarkdownRenderer />` Component
254
447
 
255
- Render a Markdown string with specific options.
448
+ Renders a Markdown string with specific options.
256
449
 
257
450
  ```tsx
258
451
  import { MarkdownRenderer } from "react-intlayer/markdown";
@@ -287,7 +480,7 @@ If you need to render raw Markdown strings or have more control over the renderi
287
480
  ```
288
481
 
289
482
  </Tab>
290
- <Tab label="Vue">
483
+ <Tab label="Vue" value="vue">
291
484
 
292
485
  #### `<MarkdownRenderer />` Component
293
486
 
@@ -398,10 +591,10 @@ If you need to render raw Markdown strings or have more control over the renderi
398
591
  </Tab>
399
592
  <Tab label="Angular" value="angular">
400
593
  #### `IntlayerMarkdownService` Service
401
- Render a Markdown string using the service.
594
+ Renders a Markdown string using the service.
402
595
 
403
596
  ```typescript
404
- import { IntlayerMarkdownService } from "angular-intlayer";
597
+ import { IntlayerMarkdownService } from "angular-intlayer/markdown";
405
598
 
406
599
  export class MyComponent {
407
600
  constructor(private markdownService: IntlayerMarkdownService) {}
@@ -419,7 +612,7 @@ If you need to render raw Markdown strings or have more control over the renderi
419
612
 
420
613
  ## Global Configuration with `MarkdownProvider`
421
614
 
422
- You can configure Markdown rendering globally for your entire application. This avoids passing the same props to every renderer.
615
+ The `MarkdownProvider` (or its framework equivalent) configures the Markdown rendering pipeline for your entire application. This applies to both the automatic `useIntlayer` rendering and the helper utilities. Options set here are the defaults — `.use()` overrides them at the node level.
423
616
 
424
617
  <Tabs group="framework">
425
618
  <Tab label="React / Next.js" value="react">
@@ -430,8 +623,9 @@ You can configure Markdown rendering globally for your entire application. This
430
623
  export const AppProvider = ({ children }) => (
431
624
  <MarkdownProvider
432
625
  components={{
433
- h1: ({ children }) => <h1 className="text-2xl font-bold">{children}</h1>,
434
- a: ({ href, children }) => <Link to={href}>{children}</Link>,
626
+ h1: (props) => <h1 style={{color: 'green'}} {...props} />,
627
+ a: ({ href, ...props }) => <a style={{color: 'red'}} {...props} />,
628
+ MyCustomJSXComponent: (props) => <span style={{color: 'red'}} {...props} />,
435
629
  }}
436
630
  >
437
631
  {children}
@@ -439,8 +633,30 @@ You can configure Markdown rendering globally for your entire application. This
439
633
  );
440
634
  ```
441
635
 
636
+ > MDX is supported — any component name used inside your Markdown (e.g. `<MyCustomJSXComponent />`) is resolved against the `components` map.
637
+
638
+ You can also use your own markdown renderer:
639
+
640
+ ```tsx fileName="AppProvider.tsx"
641
+ import { MarkdownProvider } from "react-intlayer/markdown";
642
+
643
+ export const AppProvider = ({ children }) => (
644
+ <MarkdownProvider
645
+ renderMarkdown={async (md) => {
646
+ // Use dynamic import to reduce the bundle size of your application
647
+ const { renderMarkdown } = await import('react-intlayer/markdown');
648
+ return renderMarkdown(md);
649
+ }}
650
+ >
651
+ {children}
652
+ </MarkdownProvider>
653
+ );
654
+ ```
655
+
656
+ > Importing your Markdown renderer dynamically is a great way to reduce the bundle size of your application.
657
+
442
658
  </Tab>
443
- <Tab label="Vue">
659
+ <Tab label="Vue" value="vue">
444
660
 
445
661
  ```typescript fileName="main.ts"
446
662
  import { createApp } from "vue";
@@ -464,6 +680,29 @@ You can configure Markdown rendering globally for your entire application. This
464
680
  app.mount("#app");
465
681
  ```
466
682
 
683
+ You can also use your own markdown renderer:
684
+
685
+ ```typescript fileName="main.ts"
686
+ import { createApp } from "vue";
687
+ import { intlayer } from "vue-intlayer";
688
+ import { intlayerMarkdown } from "vue-intlayer/markdown";
689
+ import App from "./App.vue";
690
+
691
+ const app = createApp(App);
692
+
693
+ app.use(intlayer);
694
+ app.use(intlayerMarkdown, {
695
+ renderMarkdown: async (md) => {
696
+ const { renderMarkdown } = await import('vue-intlayer/markdown');
697
+ return renderMarkdown(md);
698
+ },
699
+ });
700
+
701
+ app.mount("#app");
702
+ ```
703
+
704
+ > Importing your Markdown renderer dynamically is a great way to reduce the bundle size of your application.
705
+
467
706
  </Tab>
468
707
  <Tab label="Svelte" value="svelte">
469
708
 
@@ -482,6 +721,25 @@ You can configure Markdown rendering globally for your entire application. This
482
721
  </MarkdownProvider>
483
722
  ```
484
723
 
724
+ You can also use your own markdown renderer:
725
+
726
+ ```svelte fileName="App.svelte"
727
+ <script lang="ts">
728
+ import { MarkdownProvider } from "svelte-intlayer/markdown";
729
+ </script>
730
+
731
+ <MarkdownProvider
732
+ renderMarkdown={async (md) => {
733
+ const { renderMarkdown } = await import('svelte-intlayer/markdown');
734
+ return renderMarkdown(md);
735
+ }}
736
+ >
737
+ <slot />
738
+ </MarkdownProvider>
739
+ ```
740
+
741
+ > Importing your Markdown renderer dynamically is a great way to reduce the bundle size of your application.
742
+
485
743
  </Tab>
486
744
  <Tab label="Preact" value="preact">
487
745
 
@@ -499,6 +757,25 @@ You can configure Markdown rendering globally for your entire application. This
499
757
  );
500
758
  ```
501
759
 
760
+ You can also use your own markdown renderer:
761
+
762
+ ```tsx fileName="AppProvider.tsx"
763
+ import { MarkdownProvider } from "preact-intlayer/markdown";
764
+
765
+ export const AppProvider = ({ children }) => (
766
+ <MarkdownProvider
767
+ renderMarkdown={async (md) => {
768
+ const { renderMarkdown } = await import('preact-intlayer/markdown');
769
+ return renderMarkdown(md);
770
+ }}
771
+ >
772
+ {children}
773
+ </MarkdownProvider>
774
+ );
775
+ ```
776
+
777
+ > Importing your Markdown renderer dynamically is a great way to reduce the bundle size of your application.
778
+
502
779
  </Tab>
503
780
  <Tab label="Solid" value="solid">
504
781
 
@@ -516,38 +793,46 @@ You can configure Markdown rendering globally for your entire application. This
516
793
  );
517
794
  ```
518
795
 
519
- </Tab>
520
- <Tab label="Angular" value="angular">
796
+ You can also use your own markdown renderer:
521
797
 
522
- ```typescript fileName="app.config.ts"
523
- import { createIntlayerMarkdownProvider } from "angular-intlayer/markdown";
798
+ ```tsx fileName="AppProvider.tsx"
799
+ import { MarkdownProvider } from "solid-intlayer/markdown";
524
800
 
525
- export const appConfig: ApplicationConfig = {
526
- providers: [
527
- createIntlayerMarkdownProvider({
528
- components: {
529
- h1: { class: "text-2xl font-bold" },
530
- },
531
- }),
532
- ],
533
- };
801
+ export const AppProvider = (props) => (
802
+ <MarkdownProvider
803
+ renderMarkdown={async (md) => {
804
+ const { renderMarkdown } = await import('solid-intlayer/markdown');
805
+ return renderMarkdown(md);
806
+ }}
807
+ >
808
+ {props.children}
809
+ </MarkdownProvider>
810
+ );
534
811
  ```
535
812
 
536
- </Tab>
537
- </Tabs>
813
+ > Importing your Markdown renderer dynamically is a great way to reduce the bundle size of your application.
538
814
 
539
- ---
815
+ </Tab>
816
+ <Tab label="Angular" value="angular">
540
817
 
541
- ## Options Reference
818
+ ```typescript fileName="app.module.ts"
819
+ import { NgModule } from '@angular/core';
820
+ import { IntlayerMarkdownModule } from 'angular-intlayer/markdown';
821
+
822
+ @NgModule({
823
+ imports: [
824
+ IntlayerMarkdownModule.forRoot({
825
+ renderMarkdown: async (md) => {
826
+ const { renderMarkdown } = await import('angular-intlayer/markdown');
827
+ return renderMarkdown(md);
828
+ }
829
+ })
830
+ ]
831
+ })
832
+ export class AppModule {}
833
+ ```
542
834
 
543
- These options can be passed to `MarkdownProvider`, `MarkdownRenderer`, `useMarkdownRenderer`, and `renderMarkdown`.
835
+ > Importing your Markdown renderer dynamically is a great way to reduce the bundle size of your application.
544
836
 
545
- | Option | Type | Default | Description |
546
- | :-------------------- | :---------- | :------ | :------------------------------------------------------------------------------------ |
547
- | `forceBlock` | `boolean` | `false` | Forces the output to be wrapped in a block-level element (e.g., `<div>`). |
548
- | `forceInline` | `boolean` | `false` | Forces the output to be wrapped in an inline element (e.g., `<span>`). |
549
- | `tagfilter` | `boolean` | `true` | Enables the GitHub Tag Filter for improved security by stripping dangerous HTML tags. |
550
- | `preserveFrontmatter` | `boolean` | `false` | If `true`, frontmatter at the beginning of the Markdown string will not be stripped. |
551
- | `components` | `Overrides` | `{}` | A map of HTML tags to custom components (e.g., `{ h1: MyHeading }`). |
552
- | `wrapper` | `Component` | `null` | A custom component to wrap the rendered Markdown. |
553
- | `renderMarkdown` | `Function` | `null` | A custom rendering function to completely replace the default Markdown compiler. |
837
+ </Tab>
838
+ </Tabs>