Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2261.
This added two options:
--html2text
simply runshtml2text
on the (minimally preprocessed) WordPress post;--transform-to-markdown
first runs the WordPress compiler and thenhtml2text
on the WordPress post.The second option is usually better as a lot of WordPress-specific things (like conversion of "..." to the corresponding Unicode character, smart quotes etc.) are then handled.
It won't work nice with code blocks, though, since the WordPress compiler compiles them to HTML which
html2text
cannot really decode back to what they should be in MarkDown. The first option doesn't work with code blocks, either, ashtml2text
doesn't know about WordPress shortcodes. To fix this, it's probably best to first remove all[code]
blocks and replace them with simple to identify and unique strings, then do the conversion, and finally put the code block contents back in.