syncfusion-angular-markdown-converter
Implement the Syncfusion Angular Markdown Converter to convert Markdown text into clean HTML. Use this when converting Markdown to HTML in Angular, integrating a live Markdown preview, configuring GFM or line break options, or working with MarkdownConverter.toHtml() and MarkdownConverterOptions. This skill covers the @syncfusion/ej2-markdown-converter package and Markdown Editor integration with side-by-side HTML preview.
What this skill does
# Implementing Syncfusion Angular Markdown Converter
The Syncfusion Angular Markdown Converter is a lightweight utility that transforms Markdown-formatted text into clean, semantic HTML. It is typically used alongside the Syncfusion Rich Text Editor (in Markdown mode) to provide a live preview of rendered content.
## When to Use This Skill
- Convert Markdown text to HTML in an Angular application
- Display a live preview of Markdown content as the user types
- Configure conversion behavior (GFM support, line breaks, async mode, error suppression)
- Build a side-by-side Markdown editor and HTML preview layout
- Integrate `MarkdownConverter.toHtml()` with the Syncfusion Rich Text Editor
## Documentation and Navigation Guide
### Getting Started
๐ **Read:** [references/getting-started.md](references/getting-started.md)
- Angular CLI setup and project creation
- Installing `@syncfusion/ej2-markdown-converter` and `@syncfusion/ej2-angular-richtexteditor`
- CSS imports for the material3 theme
- Required module injection (MarkdownEditor, Image, Link, Toolbar, Table)
- Running the application
### Convert Markdown to HTML โ toHtml API
๐ **Read:** [references/tohtml-api.md](references/tohtml-api.md)
- `MarkdownConverter.toHtml()` method signature
- Basic usage example (standalone, no editor required)
- Supported Markdown elements (headings, lists, tables, links, images, inline styles)
- Using the return value in Angular templates
### Configurable Options
๐ **Read:** [references/configurable-options.md](references/configurable-options.md)
- `MarkdownConverterOptions` interface
- `async` โ asynchronous conversion for large content
- `gfm` โ GitHub Flavored Markdown support (default: true)
- `lineBreak` โ convert single line breaks to `<br>` (default: false)
- `silence` โ suppress errors on invalid Markdown (default: false)
- Full example passing options to `toHtml()`
### Rich Text Editor Integration
๐ **Read:** [references/richtexteditor-integration.md](references/richtexteditor-integration.md)
- Splitter-based side-by-side editor and preview layout
- Configuring `ejs-richtexteditor` in Markdown `editorMode`
- Real-time preview using `onChange` and `updateValue()`
- Toolbar configuration for Markdown editing
- `MarkdownFormatter` for custom Markdown syntax
- Custom preview toggle button (fullPreview pattern)
- Mobile/device orientation handling with `Browser.isDevice`
## Quick Start
Install packages and wire up the converter in three steps:
**1. Install packages:**
```bash
npm install @syncfusion/ej2-markdown-converter
npm install @syncfusion/ej2-angular-richtexteditor
```
**2. Import CSS in `src/styles.css`:**
```css
@import '../node_modules/@syncfusion/ej2-base/styles/material3.css';
@import '../node_modules/@syncfusion/ej2-richtexteditor/styles/material3.css';
```
**3. Convert Markdown to HTML:**
```typescript
import { MarkdownConverter } from '@syncfusion/ej2-markdown-converter';
const markdown = '# Hello World\nThis is **Markdown** text.';
const html = MarkdownConverter.toHtml(markdown);
console.log(html);
// Output: <h1>Hello World</h1><p>This is <strong>Markdown</strong> text.</p>
```
## Common Patterns
### Pattern 1: Standalone Conversion (No Editor)
When you only need to convert a Markdown string to HTML without an editor UI:
```typescript
import { MarkdownConverter } from '@syncfusion/ej2-markdown-converter';
const html = MarkdownConverter.toHtml(markdownString);
document.getElementById('preview')!.innerHTML = html as string;
```
### Pattern 2: Live Preview on Keyup
Convert on every keystroke inside a Rich Text Editor textarea:
```typescript
public markDownConversion(): void {
const textarea = this.editorObj.contentModule.getEditPanel() as HTMLTextAreaElement;
const previewEl = document.getElementById('html-view') as HTMLElement;
previewEl.innerHTML = MarkdownConverter.toHtml(textarea.value) as string;
}
```
### Pattern 3: Conversion with Options
Disable GFM and enable line-break conversion:
```typescript
const html = MarkdownConverter.toHtml(markdownString, {
gfm: false,
lineBreak: true
});
```
### Pattern 4: Side-by-Side Preview with Splitter
For a full editor + preview experience, use the Syncfusion Splitter component alongside the Rich Text Editor in Markdown mode. The preview pane is updated via `updateValue()` on every change event.
๐ **Read:** [references/richtexteditor-integration.md](references/richtexteditor-integration.md) for the full implementation.
## Key Props / API
| API | Type | Default | Purpose |
|-----|------|---------|---------|
| `MarkdownConverter.toHtml(content, options?)` | static method | โ | Converts Markdown string to HTML |
| `options.async` | boolean | `false` | Async conversion for large content |
| `options.gfm` | boolean | `true` | GitHub Flavored Markdown support |
| `options.lineBreak` | boolean | `false` | Single line breaks โ `<br>` |
| `options.silence` | boolean | `false` | Suppress errors on invalid Markdown |
Related in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4โv5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.