Conversion from block mark-up to/from Markdown
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
- 30/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- PHP
- Star
- 2
- Fork
- 1
- Merge trung bình
- 6 phút
- Pull request đã merge (30 ngày)
- 2
Hướng dẫn đóng góp
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 tương tự
-
priority: p3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nextcloud/fulltextsearch#1011 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
phpstan/phpstan-doctrine#794 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Automattic/static-site-importer#1767 ·