Feature: Add Classic Editor & Standard HTML Support for Post Import/Export (PushMd)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Bắt đầu với Push_MD_Plugin và lần theo các đường dẫn nhập/xuất qua Push_MD_Markdown_Consumer và Push_MD_Markdown_Producer. Xem xét các API WordPress được nêu để phát hiện trình soạn thảo và các yêu cầu của Push_MD_HTML_Converter. Được coi là hoàn thành khi các bài viết trong trình soạn thảo khối vẫn giữ nguyên hành vi của Gutenberg, trong khi các bài viết của Classic Editor và HTML tiêu chuẩn được chuyển đổi chính xác theo cả hai chiều, bao gồm siêu dữ liệu và định dạng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Overview
Currently, Push MD assumes all WordPress posts use the Gutenberg Block Editor and wraps content in block comments (e.g., <!-- wp:paragraph -->). On sites or post types where the Classic Editor is active (or where Gutenberg is disabled), importing Markdown yields block-comment markup in plain HTML editors, while exporting classic HTML posts is broken and even simple headings and lists do not convert to clean Markdown.
I understand Gutenberg is much cleaner to implement and HTML can be messy. But a lot of people still use Classic Editor or hand coded HTML.
We should support Classic Editor and non-block post types natively during both import (Markdown → HTML) and export (HTML → Markdown).
Note: I've already implemented this and will be sending a PR soon. Creating this issue for reference.
Technical Plan
1. Editor Detection Strategy
- Introduce a helper method
is_block_editor_enabled( $post_type )inPush_MD_Plugin:- Check WordPress core's
use_block_editor_for_post_type( $post_type )when available. - Fall back to checking if
register_block_typeexists. - Provide a filter
push_md_use_block_editorallowing developers to override the decision per post type.
- Check WordPress core's
2. Markdown Consumer Wrapper (Push_MD_Markdown_Consumer)
- Wrap
WordPress\Markdown\MarkdownConsumerto handle classic editor post targets (because we may not want to modify the vendor components):- When block editor is enabled for the target post type: delegate directly to
MarkdownConsumerto return Gutenberg block markup. - When block editor is disabled for the target post type:
- Consume Markdown via
MarkdownConsumer. - Strip Gutenberg block comment wrappers (e.g.,
<!-- wp:... -->and<!-- /wp:... -->). - Remove block-specific CSS classes (
wp-block-*). - Normalize excess blank lines to output clean standard HTML suitable for the Classic Editor.
- Consume Markdown via
- When block editor is enabled for the target post type: delegate directly to
3. Markdown Producer Wrapper (Push_MD_Markdown_Producer)
- Wrap
WordPress\Markdown\MarkdownProducerto handle posts without block markup (because we may not want to modify the vendor components):- Detect whether content contains Gutenberg blocks (
has_blocks( $content )or fallback delimiter check<!-- wp:). - Gutenberg content: Delegate to
MarkdownProducerand normalize the output Markdown. - Classic/Standard HTML content: Extract post metadata into YAML frontmatter and convert standard HTML into clean Markdown.
- Detect whether content contains Gutenberg blocks (
4. HTML to Markdown Converter (Push_MD_HTML_Converter)
- Provide bidirectional conversion and normalization utilities for HTML/Markdown:
- Convert standard HTML tags (headings, paragraphs, lists, links, blockquotes, inline formatting) into idiomatic Markdown.
- Handle list items, line breaks, and paragraph spacing cleanly without redundant blank lines.
- Provide normalization routines for produced Markdown output - for common quirks like extra spaces, non-breaking spaces etc.
- Ngôn ngữ chính
- PHP
- Star
- 22
- Fork
- 5
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Automattic/php-toolkit
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Automattic/php-toolkit#89 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Automattic/php-toolkit#102 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
Automattic/php-toolkit#95 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Automattic/php-toolkit#88 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Automattic/php-toolkit#87 ·
Tất cả issue của Automattic/php-toolkit
Issue tương tự
-
tooling
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
UX
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
ProfessionalWiki/NeoWiki#1525 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
bug customer-reported
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
MagnaCapax/PMSS#949 ·
-
responsive-media kses allow-list strips clipPathUnits, collapsing objectBoundingBox clip paths Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Automattic/static-site-importer#1829 ·