readmeio / markdown

ReadMe's flavored Markdown parser and React-based rendering engine.
https://rdmd.readme.io
ISC License
33 stars 9 forks source link

chore(astToPlainText): processor improvements #925

Closed rafegoldberg closed 2 months ago

rafegoldberg commented 2 months ago
πŸ“– PR App

🧰 Changes

Magic HTML blocks were being entirely skipped when serializing to plain text.

🧬 QA & Testing

Pull down this branch and try running the following snippet. If the HTML block serializes to plain text nicely (instead of giving back a blank string) this worked! :tada:

const docBody = '[block:html]{ "html": "<p>Lorem <b>ipsum</b> dolor sit amet, consectetur adipiscing elit.</p>" }[/block]\n\n> πŸ‘ title\n> complex|multi\n> ---|---\n> child|body';

const output = rdmd.astToPlainText(rdmd.hast(docBody));

Now give the astToPlainText() unit tests a whirl. If everything comes up green, we're good! 🀘

npx jest --watch -- astToPlainText.test.js
rafegoldberg commented 2 months ago

This PR was released!

πŸš€ Changes included in v6.87.0