TryGhost / wp-ghost-exporter

A WordPress plugin to export content to Ghost
https://wordpress.org/plugins/ghost/
GNU General Public License v2.0
30 stars 19 forks source link

HTML inside of HTML-tags is converted to Markdown. #4

Closed vskjefst closed 5 years ago

vskjefst commented 8 years ago

Example:

<div class="footnotes">
<h1>Footnotes</h1>
1) Not, it's not "<a href="https://duckduckgo.com/?q=piqued my interest">peaked</a>".
</div>

is converted to

<div class="footnotes">
# Footnotes
1) Not, it’s not “[peaked](https://duckduckgo.com/?q=piqued my interest)“.
</div>

Expected behavior is that the HTML inside the div-element isn't converted, since Markdown inside of HTML-tags isn't parsed, ref. "Inline HTML"

archonia-chris commented 8 years ago

Ran into the same problem. Changed the following to fix it: lib/html-to-markdown/HTML-To-Markdown.php

private function convert_children( $node ) { // Don't convert HTML code inside <code> blocks to Markdown - that should stay as HTML if ( self::is_child_of( 'code', $node ) ) {

->

... if ( self::is_child_of( 'code', $node ) || self::is_child_of( 'div', $node ) ) {

nuclearpengy commented 5 years ago

I've tested this use case and I think it's safe to close this issue now.

tymoxx commented 4 years ago

I am migrating the blog from WordPress to Ghost and the posts were not converted to Markdown at all. Do I need to do anything extra the get them converted to Markdown?