MarkdownSerializer
@blobs/sdk / serializers / MarkdownSerializer
Defined in: serializers/MarkdownSerializer.ts:24
Serializer that converts Markdown content to and from HTML for editing.
Supports headings, bold/italic/strikethrough, inline code, fenced code blocks, links, blockquotes, ordered/unordered lists, and horizontal rules. Pattern translation is regex-based, which is fast but not spec-perfect — it is intentionally tuned for the editor round-trip rather than full CommonMark/GFM compliance.
Extends
Constructors
Constructor
new MarkdownSerializer(
config?):MarkdownSerializer
Defined in: serializers/MarkdownSerializer.ts:116
Parameters
config?
Optional SerializerConfig overrides.
Returns
MarkdownSerializer
Overrides
Properties
config
protectedconfig:SerializerConfig
Defined in: serializers/BaseSerializer.ts:35
Effective configuration (defaults merged with constructor overrides).
Inherited from
format
readonlyformat:ContentFormat='markdown'
Defined in: serializers/MarkdownSerializer.ts:25
The content format this serializer handles.
Overrides
Methods
configure()
configure(
config):void
Defined in: serializers/BaseSerializer.ts:62
Merges new options into the current configuration.
Parameters
config
Partial config to apply.
Returns
void
Inherited from
getConfig()
getConfig():
SerializerConfig
Defined in: serializers/BaseSerializer.ts:69
Returns a defensive copy of the current configuration.
Returns
Inherited from
escapeHTML()
protectedescapeHTML(text):string
Defined in: serializers/BaseSerializer.ts:76
Escape HTML special characters
Parameters
text
string
Returns
string
Inherited from
unescapeHTML()
protectedunescapeHTML(html):string
Defined in: serializers/BaseSerializer.ts:90
Unescape HTML entities back to characters
Parameters
html
string
Returns
string
Inherited from
createLineBreak()
protectedcreateLineBreak():string
Defined in: serializers/BaseSerializer.ts:105
Create a line break element based on config
Returns
string
Inherited from
BaseSerializer.createLineBreak
wrapParagraph()
protectedwrapParagraph(content,className?):string
Defined in: serializers/BaseSerializer.ts:116
Create a paragraph wrapper
Parameters
content
string
className?
string
Returns
string
Inherited from
stripTags()
protectedstripTags(html):string
Defined in: serializers/BaseSerializer.ts:124
Strip all HTML tags from a string
Parameters
html
string
Returns
string
Inherited from
normalizeWhitespace()
protectednormalizeWhitespace(text):string
Defined in: serializers/BaseSerializer.ts:131
Normalize whitespace in content
Parameters
text
string
Returns
string
Inherited from
BaseSerializer.normalizeWhitespace
divBreaksToNewlines()
protecteddivBreaksToNewlines(html):string
Defined in: serializers/BaseSerializer.ts:141
Convert contenteditable div breaks to newlines
Parameters
html
string
Returns
string
Inherited from
BaseSerializer.divBreaksToNewlines
parseHTML()
protectedparseHTML(html):string
Defined in: serializers/BaseSerializer.ts:161
Parse HTML using DOMParser if available, fallback to regex
Parameters
html
string
Returns
string
Inherited from
toContent()
toContent(
html):ParsedContent
Defined in: serializers/MarkdownSerializer.ts:126
Reverses the HTML produced by MarkdownSerializer.toHTML back into Markdown source.
Parameters
html
string
HTML emitted by the editor.
Returns
Overrides
toHTML()
toHTML(
content):RenderedHTML
Defined in: serializers/MarkdownSerializer.ts:164
Renders Markdown source into HTML suitable for contenteditable display. Code blocks are protected from inline replacements during conversion and re-inserted afterward.
Parameters
content
string
Markdown source to render.