Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Feature: Add Classic Editor & Standard HTML Support for Post Import/Export (PushMd)

Aperta
#91 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
php, wordpress
Ambito
backend, content

Direzione di ricerca

Inizia con Push_MD_Plugin e segui i percorsi di importazione/esportazione attraverso Push_MD_Markdown_Consumer e Push_MD_Markdown_Producer. Esamina le API di WordPress indicate per il rilevamento dell’editor e i requisiti di Push_MD_HTML_Converter. Il lavoro è completato quando i post dell’editor a blocchi mantengono il comportamento di Gutenberg, mentre i post di Classic Editor e quelli in HTML standard vengono convertiti correttamente in entrambe le direzioni, inclusi metadati e formattazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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 ) in Push_MD_Plugin:
    • Check WordPress core's use_block_editor_for_post_type( $post_type ) when available.
    • Fall back to checking if register_block_type exists.
    • Provide a filter push_md_use_block_editor allowing developers to override the decision per post type.
2. Markdown Consumer Wrapper (Push_MD_Markdown_Consumer)
  • Wrap WordPress\Markdown\MarkdownConsumer to 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 MarkdownConsumer to 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.
3. Markdown Producer Wrapper (Push_MD_Markdown_Producer)
  • Wrap WordPress\Markdown\MarkdownProducer to 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 MarkdownProducer and normalize the output Markdown.
    • Classic/Standard HTML content: Extract post metadata into YAML frontmatter and convert standard HTML into clean Markdown.
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.
Lingua principale
PHP
Stelle
22
Fork
5
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Automattic/php-toolkit

Tutte le issue di Automattic/php-toolkit

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.