Skip to content

v1.2.0 - Metadata Comments Support for Basic Parser

Choose a tag to compare

@JeromeErasmus JeromeErasmus released this 22 Sep 12:39
· 62 commits to main since this release
b16b78e

πŸš€ New Features

Metadata Comments Support in Basic Parser

  • βœ… Smart Detection: Basic Parser now automatically detects metadata comments and switches processing modes
  • βœ… Hybrid Performance: Fast path (~0.9ms) for simple documents, enhanced path (~3.4ms) for metadata comments
  • βœ… Full Compatibility: Uses same processMetadataComments utility as Enhanced Parser for consistent behavior
  • βœ… Backward Compatible: No API changes - existing code continues to work exactly the same

Documentation Corrections

  • πŸ”§ Fixed Inaccurate Feature Matrix: Both parsers now correctly show full ADF block support
  • πŸ”§ Corrected ADF Extensions: Basic Parser supports ALL ADF blocks (panel, expand, mediaSingle, mediaGroup), not just panels/expands
  • πŸ“ Updated Performance Notes: Clear explanation of hybrid processing behavior

πŸ“Š Performance Comparison

Parser Simple Documents With Metadata Comments
Basic Parser ~0.9ms (fast path) ~3.4ms (enhanced path)
Enhanced Parser ~3.4ms (always enhanced) ~3.4ms (always enhanced)

πŸ”„ Migration Guide

No migration needed! This is a fully backward-compatible enhancement.

For Existing Basic Parser Users

// Your existing code continues to work exactly the same
const parser = new MarkdownParser();
const adf = parser.parse(markdown); // Now supports metadata comments automatically!

New Metadata Comments Support

const markdownWithMetadata = `
<!-- adf:heading textAlign="center" -->
# Centered Heading

<!-- adf:paragraph lineHeight="1.5" -->
This paragraph has custom line height.
`;

const parser = new MarkdownParser(); // Basic Parser now handles this!
const adf = parser.parse(markdownWithMetadata);
// Custom attributes are preserved: heading.attrs.textAlign === "center"

🎯 What's Next

The Basic Parser now provides the best of both worlds:

  • ⚑ Lightning-fast performance for simple documents
  • 🎨 Full metadata comments support when needed
  • πŸ”„ Automatic mode switching based on content
  • πŸ“¦ Same feature parity as Enhanced Parser for ADF blocks

Choose Basic Parser for performance-critical applications that occasionally need metadata comments support.