Problem
datamachine/publish-wordpress, datamachine/insert-content, datamachine/edit-post-blocks, and datamachine/replace-post-blocks accept content only as HTML. Any CPT that stores markdown as its authoring substrate has to either:
- Pre-convert markdown → HTML in the caller (duplicated across every consumer).
- Ship a wrapper ability that converts then delegates to the DM generic.
Intelligence's wiki is option 2 today: intelligence/wiki-create and intelligence/wiki-update each call Intelligence_Wiki_Content::markdown_to_html() then delegate to the WP write path. These wrappers exist only because DM generics can't accept markdown.
Proposal
Add an optional content_format parameter to the content-writing abilities:
```php
[
'content' => '# heading\n\nbody text',
'content_format' => 'markdown', // or 'html' (default — preserves current behaviour)
// ... existing params
]
```
When content_format = 'markdown', the ability invokes the Markdown → HTML converter before passing to wp_insert_post / wp_update_post / block edit helpers. The conversion helper already exists in the Intelligence wiki layer (Intelligence_Wiki_Content::markdown_to_html() — uses league/commonmark + html-to-blocks-converter); it could move to DM core as DataMachine\\Content\\Markdown::to_html() and be consumed by any DM ability that accepts text.
Consumers that would benefit
- Intelligence wiki-create / wiki-update: collapse from ~150-line ability + helper dispatch to a one-line forward to DM generic with
content_format: 'markdown'. Architectural win — makes explicit that wiki is just a CPT consumer of DM generics.
- Any markdown-substrate CPT (docs, notes, knowledge bases, external wikis): gets markdown support for free.
- AI pipelines that author content: AI output is naturally markdown; native markdown input means no conversion boilerplate in the prompt or handler.
Implementation note
If html-to-blocks-converter is present (common in Intelligence installs), HTML already lands as serialised blocks post-conversion. The markdown pathway would flow markdown → HTML → blocks transparently, same as today's wiki pathway — with the only difference being the entry point.
When to build
When a second markdown-substrate CPT shows up, or when someone wants to author DM content with markdown directly from chat/pipeline without a wrapper. File now to track the latent need.
Alternative considered
Keep it plugin-side forever — every CPT ships its own markdown wrapper ability. That's today's reality; it works but is the kind of duplication we've been trying to avoid (see Automattic/intelligence#147 for the latest round of that cleanup).
References
- Automattic/intelligence#147 — wiki refactor; the markdown-wrapping pattern made explicit in
Intelligence_Wiki_Create_Ability / Intelligence_Wiki_Update_Ability.
chubes4/html-to-blocks-converter — the HTML → blocks transform that would compose cleanly with a core markdown → HTML step.
Problem
datamachine/publish-wordpress,datamachine/insert-content,datamachine/edit-post-blocks, anddatamachine/replace-post-blocksaccept content only as HTML. Any CPT that stores markdown as its authoring substrate has to either:Intelligence's wiki is option 2 today:
intelligence/wiki-createandintelligence/wiki-updateeach callIntelligence_Wiki_Content::markdown_to_html()then delegate to the WP write path. These wrappers exist only because DM generics can't accept markdown.Proposal
Add an optional
content_formatparameter to the content-writing abilities:```php
[
'content' => '# heading\n\nbody text',
'content_format' => 'markdown', // or 'html' (default — preserves current behaviour)
// ... existing params
]
```
When
content_format = 'markdown', the ability invokes the Markdown → HTML converter before passing towp_insert_post/wp_update_post/ block edit helpers. The conversion helper already exists in the Intelligence wiki layer (Intelligence_Wiki_Content::markdown_to_html()— usesleague/commonmark+html-to-blocks-converter); it could move to DM core asDataMachine\\Content\\Markdown::to_html()and be consumed by any DM ability that accepts text.Consumers that would benefit
content_format: 'markdown'. Architectural win — makes explicit that wiki is just a CPT consumer of DM generics.Implementation note
If
html-to-blocks-converteris present (common in Intelligence installs), HTML already lands as serialised blocks post-conversion. The markdown pathway would flowmarkdown → HTML → blockstransparently, same as today's wiki pathway — with the only difference being the entry point.When to build
When a second markdown-substrate CPT shows up, or when someone wants to author DM content with markdown directly from chat/pipeline without a wrapper. File now to track the latent need.
Alternative considered
Keep it plugin-side forever — every CPT ships its own markdown wrapper ability. That's today's reality; it works but is the kind of duplication we've been trying to avoid (see Automattic/intelligence#147 for the latest round of that cleanup).
References
Intelligence_Wiki_Create_Ability/Intelligence_Wiki_Update_Ability.chubes4/html-to-blocks-converter— the HTML → blocks transform that would compose cleanly with a core markdown → HTML step.