Skip to content

feat(stringify): inline/block detection and #default slot emission#42

Merged
farnabaz merged 2 commits intomainfrom
feat/specs-update
Mar 6, 2026
Merged

feat(stringify): inline/block detection and #default slot emission#42
farnabaz merged 2 commits intomainfrom
feat/specs-update

Conversation

@larbish
Copy link
Contributor

@larbish larbish commented Mar 6, 2026

Inline/block component detection (mdc.ts)

A component is now stringified as inline only when it appears inline in text flow

// Before
:inline[Syntax]

// After 
::inline
Syntax
::

// Text siblings → still inline (unchanged)
inline :component syntax

#default slot emission (template.ts)

The #default slot marker is now omitted when it is the only slot in a component. It is preserved when multiple named slots are present.

// Single slot: #default dropped
::component
Content
::

// Multiple slots: #default kept
::component
#first
First

#default
Second
::

Parent propagation (strong.ts, emphesis.ts)

strong and em now pass themselves as parent when processing children, consistent with p and a. This is required so that MDC components nested inside bold or italic are correctly detected as inline.

@larbish larbish requested review from atinux and farnabaz March 6, 2026 15:03
@vercel
Copy link

vercel bot commented Mar 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comark Ready Ready Preview Mar 6, 2026 3:03pm

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 6, 2026

Open in StackBlitz

npm i https://pkg.pr.new/comarkdown/comark@42
npm i https://pkg.pr.new/comarkdown/comark/@comark/cjk@42
npm i https://pkg.pr.new/comarkdown/comark/@comark/math@42
npm i https://pkg.pr.new/comarkdown/comark/@comark/mermaid@42

commit: 00a698c

@farnabaz farnabaz merged commit 5ea621b into main Mar 6, 2026
3 checks passed
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.

2 participants