Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wordpress MarkDown conversion #2448

Merged
merged 4 commits into from Aug 18, 2016
Merged

Wordpress MarkDown conversion #2448

merged 4 commits into from Aug 18, 2016

Conversation

felixfontein
Copy link
Contributor

Fixes #2261.

This added two options:

  1. --html2text simply runs html2text on the (minimally preprocessed) WordPress post;
  2. --transform-to-markdown first runs the WordPress compiler and then html2text 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, as html2text 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.

@ralsina
Copy link
Member

ralsina commented Aug 18, 2016

LGTM

@ralsina ralsina merged commit c9e8406 into master Aug 18, 2016
@Kwpolska Kwpolska deleted the wordpress-markdown-conversion branch May 20, 2017 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

import_wordpress don't convert to markdown
2 participants