Conversion from block mark-up to/from Markdown
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 30/100
Direzione di ricerca
Start by reviewing the related wp-cli/ideas issue and the linked wxr converter to understand existing approaches to block markup conversion. A complete result would define the supported export and import scope, configurable Markdown handling, standard block handlers, and behavior for unknown blocks.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Feature Request
- Yes, I reviewed the contribution guidelines.
Describe your use case and the problem you are facing
Export from existing WordPress installation's Gutenberg pages to Markdown for interop with other content engines or to LLMs which tend to like Markdown. Import would also be great. My usecase is to convert to Markdown the block markup syntax strings found in WXR files exported from an existing WP installation.
Describe the solution you'd like
Versatile / configurable export from block markup to Markdown. Custom attributes can be optionally exported via CommonMark Directive syntax which already has support in remark. Even if conversion is not 100% faithful, it is already useful: e.g. for making existing WordPress content consumable in good form for RAG / LLMs.
There are a lot of various existing markdown plugins for WordPress, but there is a need for a well-tested official one (which will be maintained, currently maintenance is also fragmented, there are plenty of abandoned exporters), but versatile one which can be scripted, so it's a good fit for CLI command, in my opinion.
Ideally, there must be handlers for standard block types, and some catch-all for optionally exporting verbatim HTML for the blocks which do not have registered markdown converter. Having some HTML in Markdown is also fine, as the user can then postproc the markdown files with remark/rehype pipelines.
IMO such exporter should accept that there does not exist a single right way to export to Markdown so some configurability is to be expected, as users may want to get different flavors of Markdown (e.g. both preserving the text color as Directives, or just dropping it altogether are good and useful, depending on the user's usecase).
Related:
For now, I had to roll my own https://github.com/vadimkantorov/wxr for exporting block markup from WXR to HTML files (preserving attributes), and then for converting them to Markdown (and also allowing some custom URL / image URL postprocessing / downloading the linked images etc). In this converter I'm often representing unknown blocks as:
---
blah blah some info about a block without a standard way to represent in Markdown (not frontmatter)
---
more markdown
So essentially using a pair of --- dividers to enclose some block info. Then a custom remark/rehype pipeline could interpret / render these in a custom way if a user desires so.
- Lingua principale
- PHP
- Stelle
- 2
- Fork
- 1
- Merge medio
- 6m
- PR unite (30g)
- 2
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Issue simili
-
sync-en
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
-
sync-en
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
-
Перевод устарел
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
-
[6.x]: "Cannot use object of type stdClass as array" loading Users index (regression of #19182) Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100