createBlockMarkdownSpec
@blockslides/core / createBlockMarkdownSpec
Function: createBlockMarkdownSpec()
createBlockMarkdownSpec(
options):object
Defined in: blockslides/packages/core/src/utilities/markdown/createBlockMarkdownSpec.ts:60
Creates a complete markdown spec for block-level nodes using Pandoc syntax.
The generated spec handles:
- Parsing blocks with
:::blockName {attributes}syntax - Extracting and parsing attributes
- Rendering blocks back to markdown with proper formatting
- Nested content support
Parameters
options
Configuration for the block markdown spec
Returns
object
Complete markdown specification object
parseMarkdown()
parseMarkdown: (
token,h) =>MarkdownParseResult
Parameters
token
h
Returns
markdownTokenizer
markdownTokenizer:
MarkdownTokenizer
renderMarkdown()
renderMarkdown: (
node,h) =>string
Parameters
node
h
Returns
string
Example
const calloutSpec = createBlockMarkdownSpec({
nodeName: 'callout',
defaultAttributes: { type: 'info' },
allowedAttributes: ['type', 'title'] // Only these get rendered to markdown
})
// Usage in extension:
export const Callout = Node.create({
// ... other config
markdown: calloutSpec
})