שאלו את שאלתכם וקבלו סיכום של המסמך על ידי הפניה לדף הזה ולספק ה-AI שתבחרו
היסטוריית גרסאות
- "Automatic decoration of markdown content, MDX and SSR support"v8.11.028.5.2026
- "Add `.content.md` files support"v8.10.019.5.2026
- "Add `intlayerMarkdown` plugin object; use `app.use(intlayerMarkdown)` instead of `app.use(installIntlayerMarkdown)`"v8.5.024.3.2026
- "move import from `{{framework}}-intlayer` to `{{framework}}-intlayer/markdown`"v8.5.024.3.2026
- "Add MarkdownRenderer / useMarkdownRenderer / renderMarkdown utility and forceInline option"v8.0.022.1.2026
- "Automatic decoration of markdown content, MDX and SSR support"v8.0.018.1.2026
- "Init history"v5.5.1029.6.2025
התוכן של הדף הזה תורגם באמצעות AI.
צפייה בגרסה האחרונה של התוכן המקורי באנגליתאם יש לכם רעיון לשיפור התיעוד הזה, אל תהססו לתרום על ידי הגשת Pull Request ב-GitHub.
קישור GitHub לתיעודהעתקת ה-Markdown של המסמך ללוח
Markdown / Rich Text Content
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.
Declaring Markdown Content
You can declare Markdown content using the md function or simply as a string (if it contains Markdown syntax).
Since version 8.10.0, you can declare Markdown content directly in .content.md files. Intlayer will
automatically detect and parse the Markdown content.
העתקת הקוד ללוח
The locale front-matter 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.
Example of file structure:
העתקת הקוד ללוח
You can add in front-matter any properties defined in the Dictionary definition
Use the md function to explicitly declare Markdown content. This is useful if you want to ensure a string is treated as Markdown even if it doesn't contain obvious syntax.
העתקת הקוד ללוח
Import .md files directly using the file function.
העתקת הקוד ללוח
If the string contains common Markdown indicators (like headers, lists, links, etc.), Intlayer will automatically transform it.
העתקת הקוד ללוח
Rendering Markdown
Intlayer provides two independent ways to render Markdown:
Via
useIntlayerIntlayer automatically transforms themdnode into the framework's native output (JSX, VNode, HTML string).- Frontmatter is parsed and exposed as
.metadata. You can override rendering at two levels, globally withMarkdownProvider(or the framework equivalent) and locally per-node with.use(). Both can be combined;.use()takes priority overMarkdownProvider, which takes priority over the default.
- Frontmatter is parsed and exposed as
Helper utilities:
<MarkdownRenderer />,useMarkdownRenderer(), andrenderMarkdown()are standalone tools that accept raw Markdown strings only. They are independent ofuseIntlayerand do not work with the decorated nodes it returns.
Markdown rendering supports MDX. Use any JSX/framework component by name directly in your Markdown.
1. Automatic Rendering (via useIntlayer)
Markdown nodes can be rendered directly as JSX.
העתקת הקוד ללוח
If MarkdownProvider not present, intlayer will render the markdown using the default Markdown to JSX parser.
You can also provide local overrides for specific nodes using the .use() method:
העתקת הקוד ללוח
You can retrieve the Markdown as string:
העתקת הקוד ללוח
And you can access your markdown metadata like :
העתקת הקוד ללוח
Markdown nodes can be rendered directly as JSX.
העתקת הקוד ללוח
If MarkdownProvider not present, intlayer will render the markdown using the default Markdown to JSX parser.
You can also provide local overrides for specific nodes using the .use() method:
העתקת הקוד ללוח
You can retrieve the Markdown as string:
העתקת הקוד ללוח
And you can access your markdown metadata like :
העתקת הקוד ללוח
In Vue, Markdown content can be rendered using the component built-in or directly as a node.
העתקת הקוד ללוח
Configure globally via the intlayerMarkdown plugin (supports MDX custom components):
העתקת הקוד ללוח
If the intlayerMarkdown plugin is not installed, Intlayer will render using the default compiler.
You can also provide local overrides for specific nodes using the .use() method:
העתקת הקוד ללוח
You can retrieve the Markdown as string:
העתקת הקוד ללוח
And you can access your markdown metadata like :
העתקת הקוד ללוח
Svelte renders Markdown as an HTML string by default. Use {@html} to render it.
העתקת הקוד ללוח
If MarkdownProvider is not present, Intlayer will render the markdown using the default compiler.
You can also provide local overrides for specific nodes using the .use() method:
העתקת הקוד ללוח
You can retrieve the Markdown as string:
העתקת הקוד ללוח
And you can access your markdown metadata like :
העתקת הקוד ללוח
Preact supports Markdown nodes directly in JSX.
העתקת הקוד ללוח
If MarkdownProvider not present, intlayer will render the markdown using the default Markdown to JSX parser.
You can also provide local overrides for specific nodes using the .use() method:
העתקת הקוד ללוח
You can retrieve the Markdown as string:
העתקת הקוד ללוח
And you can access your markdown metadata like :
העתקת הקוד ללוח
Solid supports Markdown nodes directly in JSX.
העתקת הקוד ללוח
If MarkdownProvider not present, intlayer will render the markdown using the default Markdown to JSX parser.
You can also provide local overrides for specific nodes using the .use() method:
העתקת הקוד ללוח
You can retrieve the Markdown as string:
העתקת הקוד ללוח
And you can access your markdown metadata like :
העתקת הקוד ללוח
Angular uses the [innerHTML] directive to render Markdown content.
העתקת הקוד ללוח
If the IntlayerMarkdown provider is not configured, Intlayer will render using the default compiler.
You can also provide local overrides for specific nodes using the .use() method:
העתקת הקוד ללוח
You can retrieve the Markdown as string:
העתקת הקוד ללוח
And you can access your markdown metadata like :
העתקת הקוד ללוח
In Remix 3, Markdown nodes are rendered on the server into an HTML string. Inject it with the innerHTML prop of Remix JSX, or with html.raw in an html-template view.
העתקת הקוד ללוח
העתקת הקוד ללוח
Remix escapes interpolated values by default.innerHTMLandhtml.raware the two opt-outs, which is what a rendered Markdown string needs.
You can also provide local overrides for specific tags using the .use() method. Overrides are functions returning an HTML string:
העתקת הקוד ללוח
.value is the rendered HTML string, while String() / .toString() give back the raw Markdown source:
העתקת הקוד ללוח
And you can access your markdown metadata like :
העתקת הקוד ללוח
In Astro, Markdown nodes are rendered into an HTML string. Inject it with the set:html directive in the template, or with innerHTML in a client <script>.
העתקת הקוד ללוח
העתקת הקוד ללוח
Astro escapes{expressions}by default.set:htmlis the opt-out, which is what a rendered Markdown string needs.
You can also provide local overrides for specific tags using the .use() method. Overrides are functions returning an HTML string:
העתקת הקוד ללוח
.value is the rendered HTML string, while String() / .toString() give back the raw Markdown source:
העתקת הקוד ללוח
And you can access your markdown metadata like :
העתקת הקוד ללוח
2. Helper Utilities (Markdown Strings Only)
These utilities render raw Markdown strings and are independent of useIntlayer. Use them when you need to render Markdown from sources other than your dictionaries.
<MarkdownRenderer /> Component
Render a Markdown string with specific options.
העתקת הקוד ללוח
useMarkdownRenderer() Hook
Get a pre-configured renderer function.
העתקת הקוד ללוח
renderMarkdown() Utility
Standalone utility for rendering outside of components.
העתקת הקוד ללוח
<MarkdownRenderer /> Component
Render a Markdown string with specific options.
העתקת הקוד ללוח
useMarkdownRenderer() Hook
Get a pre-configured renderer function.
העתקת הקוד ללוח
renderMarkdown() Utility
Standalone utility for rendering outside of components.
העתקת הקוד ללוח
<MarkdownRenderer /> Component
העתקת הקוד ללוח
<MarkdownRenderer /> Component
העתקת הקוד ללוח
useMarkdownRenderer() Hook
העתקת הקוד ללוח
renderMarkdown() Utility
העתקת הקוד ללוח
<MarkdownRenderer /> Component
העתקת הקוד ללוח
useMarkdownRenderer() Hook
העתקת הקוד ללוח
renderMarkdown() Utility
העתקת הקוד ללוח
<MarkdownRenderer /> Component
העתקת הקוד ללוח
useMarkdownRenderer() Hook
העתקת הקוד ללוח
renderMarkdown() Utility
העתקת הקוד ללוח
IntlayerMarkdownService Service
Render a Markdown string using the service.
העתקת הקוד ללוח
useMarkdownRenderer() Hook
Get a renderer function pre-configured by installIntlayerMarkdown(). It returns an HTML string.
העתקת הקוד ללוח
renderMarkdown() Utility
Standalone utility that ignores the global configuration.
העתקת הקוד ללוח
useMarkdownRenderer() Hook
Get a renderer function pre-configured by installIntlayerMarkdown(). It returns an HTML string.
העתקת הקוד ללוח
renderMarkdown() Utility
Standalone utility that ignores the global configuration.
העתקת הקוד ללוח
Global Configuration with MarkdownProvider
MarkdownProvider (or its framework equivalent) configures the Markdown rendering pipeline for your entire application. It applies to both the automatic useIntlayer rendering and the helper utilities. Options set here are the defaults, .use() overrides them at the node level.
העתקת הקוד ללוח
MDX is supported, any component name used inside your Markdown (e.g.<MyCustomJSXComponent />) is resolved against thecomponentsmap.
You can also use your own markdown renderer:
העתקת הקוד ללוח
Importing your Markdown renderer dynamically is a good way to reduce the bundle size of your application.
העתקת הקוד ללוח
MDX is supported, any component name used inside your Markdown (e.g.<MyCustomJSXComponent />) is resolved against thecomponentsmap.
You can also use your own markdown renderer:
העתקת הקוד ללוח
Importing your Markdown renderer dynamically is a good way to reduce the bundle size of your application.
העתקת הקוד ללוח
MDX is supported, any component name used inside your Markdown (e.g.<MyCustomJSXComponent />) is resolved against thecomponentsmap.
You can also use your own markdown renderer:
העתקת הקוד ללוח
Importing your Markdown renderer dynamically is a good way to reduce the bundle size of your application.
העתקת הקוד ללוח
MDX is supported, any component name used inside your Markdown (e.g.<MyCustomJSXComponent />) is resolved against thecomponentsmap.
You can also use your own markdown renderer:
העתקת הקוד ללוח
Importing your Markdown renderer dynamically is a good way to reduce the bundle size of your application.
העתקת הקוד ללוח
MDX is supported, any component name used inside your Markdown (e.g.<MyCustomJSXComponent />) is resolved against thecomponentsmap.
You can also use your own markdown renderer:
העתקת הקוד ללוח
Importing your Markdown renderer dynamically is a good way to reduce the bundle size of your application.
העתקת הקוד ללוח
MDX is supported, any component name used inside your Markdown (e.g.<MyCustomJSXComponent />) is resolved against thecomponentsmap.
You can also use your own markdown renderer:
העתקת הקוד ללוח
Importing your Markdown renderer dynamically is a good way to reduce the bundle size of your application.
העתקת הקוד ללוח
MDX is supported, any component name used inside your Markdown (e.g.<MyCustomJSXComponent />) is resolved against thecomponentsmap.
You can also use your own markdown renderer:
העתקת הקוד ללוח
Importing your Markdown renderer dynamically is a good way to reduce the bundle size of your application.
Remix has no component tree to hold a provider, so the configuration is installed once, as a singleton, at server start. It configures the renderer returned by useMarkdownRenderer(). The md nodes returned by useIntlayer are rendered with the default compiler; override their tags per node with .use().
העתקת הקוד ללוח
You can also use your own markdown renderer:
העתקת הקוד ללוח
Use installIntlayerMarkdownDynamic(async () => …) to load the renderer itself lazily; the loader runs on the first call only.
Astro has no component tree to hold a provider, so the configuration is installed once, as a singleton, in the middleware (server) and in a client <script> (browser). It configures the renderer returned by useMarkdownRenderer(). The md nodes returned by useIntlayer are rendered with the default compiler; override their tags per node with .use().
העתקת הקוד ללוח
You can also use your own markdown renderer:
העתקת הקוד ללוח
Use installIntlayerMarkdownDynamic(async () => …) to load the renderer itself lazily; the loader runs on the first call only.
Suspense
The Intlayer Markdown renderer is dynamically loaded. Although optimized, the underlying parser chunk is approximately 55kb. Loading this synchronously delays the initial page rendering and degrades First Contentful Paint (FCP).
To prevent blocking the UI, Intlayer integrates with React's Suspense API. It fetches the parser in the background and throws a Promise during the download.
Wrap any component rendering Intlayer Markdown in a <Suspense> boundary. This displays a localized fallback state while the chunk downloads, allowing the rest of your DOM to render immediately.
Warning: If you do not provide a <Suspense> boundary, React will suspend at the root level or block the entire component tree from rendering until the 55kb chunk is fully loaded.
In Next.js App Router, you can use either React Suspense for client components or a loading.tsx file for server components.
Client Component:
העתקת הקוד ללוח
Server Component with loading.tsx:
העתקת הקוד ללוח
העתקת הקוד ללוח
העתקת הקוד ללוח
Vue has a built-in <Suspense> component. Wrap the component rendering Markdown content in a <Suspense> boundary.
העתקת הקוד ללוח
Svelte does not have a Suspense API equivalent. Use an {#await} block to handle async rendering of Markdown content.
העתקת הקוד ללוח
Preact supports React's Suspense API via preact/compat.
העתקת הקוד ללוח
Solid has its own <Suspense> component from solid-js.
העתקת הקוד ללוח
Angular does not have a Suspense API. Use Angular's deferrable views (@defer) to handle lazy-loaded Markdown content (requires Angular 17+).
העתקת הקוד ללוח
Server-Side Rendering (SSR) and Hydration
In comparison of other Markdown parser such as remark / rehype, the Intlayer Markdown is dependency free and run on client as server side.
But Intlayer optimized the parsing for Server-Side Rendering (SSR) frameworks (such as Next.js App Router, React Router, Nuxt, SvelteKit, etc.).
Instead of sending raw Markdown strings to the client and parsing them on the browser (which incurs a performance penalty), Intlayer allows you to pre-parse the Markdown into an Abstract Syntax Tree (AST) on the server.
You can use the parseMarkdown function from your framework's Intlayer package on the server side to generate a serializable AST (ParsedMarkdown object), and pass it directly to the frontend. All Intlayer rendering utilities (like <MarkdownRenderer>, useMarkdownRenderer, etc.) automatically accept this AST object and render it seamlessly.
Example in a Server/Client Architecture
העתקת הקוד ללוח
העתקת הקוד ללוח
העתקת הקוד ללוח
העתקת הקוד ללוח
העתקת הקוד ללוח
העתקת הקוד ללוח
Angular SSR typically resolves the data on the server during the initial load and hydrates on the client. You can use resolvers to pass the AST.
העתקת הקוד ללוח
העתקת הקוד ללוח
Remix 3 renders on the server and streams HTML, so no AST needs to cross to the client. Parse once, and render the AST wherever the page is built:
העתקת הקוד ללוח
Astro pages are rendered on the server, so no AST needs to cross to the client. Parse the Markdown in the frontmatter and render it with set:html:
העתקת הקוד ללוח
This pattern ensures that the Markdown parsing logic is executed entirely on the server, significantly reducing the client-side execution time and improving the initial hydration speed.
Options Reference
These options can be passed to MarkdownProvider, MarkdownRenderer, useMarkdownRenderer, and renderMarkdown.
פתיחת הטבלה בחלון כדי לראות את כל תוכן הנתונים בבירור
| Option | Type | Default | Description |
|---|---|---|---|
forceBlock | boolean | false | Forces the output to be wrapped in a block-level element (e.g., <div>). |
forceInline | boolean | false | Forces the output to be wrapped in an inline element (e.g., <span>). |
tagfilter | boolean | true | Enables the GitHub Tag Filter for improved security by stripping dangerous HTML tags. |
preserveFrontmatter | boolean | false | If true, frontmatter at the beginning of the Markdown string will not be stripped. |
components | Overrides | {} | A map of HTML tags to custom components (e.g., { h1: MyHeading }). |
wrapper | Component | null | A custom component to wrap the rendered Markdown. |
renderMarkdown | Function | null | A custom rendering function to completely replace the default Markdown compiler. |
