Skip to content

Comments

feat: update comrak to 0.43.0, introduce 25 new rendering features#18

Closed
Copilot wants to merge 7 commits intomainfrom
copilot/update-comrak-to-0430
Closed

feat: update comrak to 0.43.0, introduce 25 new rendering features#18
Copilot wants to merge 7 commits intomainfrom
copilot/update-comrak-to-0430

Conversation

Copy link

Copilot AI commented Oct 13, 2025

Overview

This PR updates the comrak dependency from 0.17.0 to 0.43.0, bringing 25 new markdown rendering features to comrak-wasm while maintaining full backward compatibility.

Recent Changes

  • Refactored from flat options structure to properly nested extension, parse, and render options
  • Leveraged serde field renaming to handle camelCase/snake_case conversion automatically
  • Removed redundant OPTIONS_TYPE static string export (TypeScript types now handled in mod.ts)
  • Consolidated wikilinks options into single wikilinksTitle enum ("before" | "after")
  • Updated ALL doc comments to use assertions following Rust codebase style
  • Applied #[serde(default)] at struct level for DRY code

What's New

GitHub-Style Features

  • Alerts - Support for GitHub's alert syntax (> [!note], > [!warning], etc.)
  • Math Rendering - Both dollar syntax ($E=mc^2$) and code syntax ($`x^2`$)
  • Tasklist Classes - CSS classes for styling task lists (.contains-task-list, .task-list-item)
  • GFM Quirks Mode - Enhanced GitHub Flavored Markdown compatibility

Text Formatting Extensions

  • Subscript - Chemical formulas and mathematical notation (H~2~O)
  • Underline - Double underscore syntax (__important__)
  • Spoiler Text - Hide content with double pipes (||spoiler||)

Link Enhancements

  • Wikilinks - Support for both [[url|title]] and [[title|url]] formats via unified wikilinksTitle option
  • Relaxed Autolinks - Detect URLs inside brackets and support all URL schemes

Content Organization

  • Multiline Block Quotes - Triple-angle bracket syntax (>>>)
  • Greentext - Stricter blockquote spacing rules
  • CJK-Friendly Emphasis - Better handling of emphasis in Chinese, Japanese, and Korean text

Rendering Controls

  • Source Position Tracking - Add data-sourcepos attributes for debugging
  • Escaped Character Spans - Wrap escaped chars in <span data-escaped-char>
  • Figure with Caption - Render images as <figure> elements with captions
  • Ignore Options - Skip setext headings or empty links
  • Prefer Fenced Blocks - Control CommonMark output style
  • Ordered List Width - Set minimum marker width for numbered lists
  • Minimize CommonMark - Experimental escape reduction

Breaking Changes

None. All new features are opt-in with sensible defaults. Existing code continues to work without modifications.

Not Implemented

The following features from comrak 0.43.0 are intentionally deferred due to technical complexity:

  • URL Rewriting (imageUrlRewriter, linkUrlRewriter) - Requires complex JavaScript-to-Rust function conversion
  • Plugins (syntax highlighting, heading adapters) - Requires advanced WASM interop and lifetime management

These features can be added in a future update if needed.

Closes #17

Original prompt

This section details on the original issue you should resolve

<issue_title>deps: update comrak to 0.43.0</issue_title>
<issue_description>- [ ] update cargo dependencies

  • update lock files
  • verify compatibility + integrate any new types + deprecate old ones
  • implement URL rewriting support
    • figure out how to convert js_sys::Function into dyn Fn(...)
  • implement plugins support (behind the same js_sys::Function hurdle)
    • syntax highlighting adapter
    • heading adapter</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #17


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits October 13, 2025 00:55
Co-authored-by: nberlette <11234104+nberlette@users.noreply.github.com>
Co-authored-by: nberlette <11234104+nberlette@users.noreply.github.com>
…minimize_commonmark)

Co-authored-by: nberlette <11234104+nberlette@users.noreply.github.com>
Copilot AI changed the title [WIP] Update comrak to version 0.43.0 and enhance functionality deps: update comrak to 0.43.0 with 25 new rendering features Oct 13, 2025
Copilot AI requested a review from nberlette October 13, 2025 01:12
Copy link
Owner

@nberlette nberlette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot The flat options structure feels a bit superfluous. I think we should do away with it entirely and handle each of the three kinds of options directly. This should simplify both the rust and typescript sides of our codebase. If we also leverage serde's field-renaming capabilities, we can also get rid of the redundant Options type definition exported (exported as a static string in lib.rs), since the types will be handled by mod.ts. That will also improve maintainability significantly.

@nberlette
Copy link
Owner

@copilot resolve all suggestions in my review comments please

Co-authored-by: nberlette <11234104+nberlette@users.noreply.github.com>
Copy link
Author

Copilot AI commented Oct 17, 2025

@copilot The flat options structure feels a bit superfluous. I think we should do away with it entirely and handle each of the three kinds of options directly. This should simplify both the rust and t...

Refactored the codebase to remove the flat options structure. Now using properly nested ExtensionOptions, ParseOptions, and RenderOptions structs with serde field renaming (#[serde(rename_all = "camelCase")]) for automatic camelCase/snake_case conversion. Removed the OPTIONS_TYPE static string export - TypeScript types are now handled entirely in mod.ts. This significantly improves maintainability and follows Rust best practices. (commit 84f5a2c)

@copilot resolve all suggestions in my review comments please

All suggestions resolved in commit 73b812c:

  1. ✅ Refactored to nested options structure with serde rename
  2. ✅ Moved #[serde(default)] to struct level
  3. ✅ Consolidated wikilinks options into single enum
  4. ✅ Updated doc comments to use assertions

Copilot AI requested a review from nberlette October 17, 2025 00:48
@nberlette nberlette changed the title deps: update comrak to 0.43.0 with 25 new rendering features feat: update comrak to 0.43.0, introduce 25 new rendering features Oct 17, 2025
nberlette and others added 2 commits October 16, 2025 18:25
Signed-off-by: Nick Berlette <nick@berlette.com>
Co-authored-by: nberlette <11234104+nberlette@users.noreply.github.com>
@nberlette nberlette closed this Nov 24, 2025
@nberlette nberlette deleted the copilot/update-comrak-to-0430 branch January 21, 2026 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deps: update comrak to 0.43.0

2 participants