Add extensible content parser with Markpub support#3
Closed
Add extensible content parser with Markpub support#3
Conversation
4 tasks
a17857b to
c5a534b
Compare
ed80bb4 to
8ab66d1
Compare
Introduce a pluggable content parser system for the `content` union field in site.standard.document records. The parser converts WordPress block content into structured AT Protocol content formats. - Add Content_Parser interface for custom parser implementations. - Add Markpub parser (at.markpub.markdown) that walks Gutenberg blocks via parse_blocks() and converts each to CommonMark markdown. - Wire content parsing into Document transformer with two filters: atmosphere_content_parser (swap/disable parser) and atmosphere_document_content (modify parsed output). - Add ?atproto query param preview endpoint for inspecting the document record JSON (requires edit_posts capability). - Add tests for all supported block types and filter integration.
Suppress pre-existing PHPCS warnings (direct DB query in uninstall, reserved keyword parameter in Base). Use load_template() for meta box to properly pass $post via $args.
- Always set the required `site` field in document records, falling back to the site URL when no publication record exists. - Change flavor from `commonmark` to `gfm` to accurately reflect the strikethrough extension used in output. - Add `extensions` field listing supported GFM extensions.
8ab66d1 to
303e6e1
Compare
The integrations directory lives on trunk; this branch should not reference it in the classmap or Atmosphere init.
11 tasks
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
contentunion field insite.standard.documentrecordsparse_blocks()and converts each to CommonMark markdown?atprotopreview endpoint on singular posts to inspect the document record JSON (requiresedit_postscapability)Extensibility
Three filters provide full control:
atmosphere_content_parsernullto disableatmosphere_document_contentatmosphere_html_to_markdownCustom parsers implement
Atmosphere\Content_Parser\Content_Parserand return any AT Protocol content format.Block types handled
Paragraph, heading (with level), image (with alt/caption), list (ordered/unordered), quote, code, preformatted, separator, group/columns containers, plus fallback for unknown blocks and classic editor content.
Test plan
?atprotopreview on a published post returns valid JSON withcontentfield?atprotois not accessible when logged outatmosphere_content_parserfilter with__return_nulldisables the content fieldnpm run env-test— all 39 tests pass