-
-
Notifications
You must be signed in to change notification settings - Fork 208
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
<pre class="language-"><code> #215
Comments
$markdown_show = $converter->convert($content);
// strip_tags pre
$markdown_show = strip_tags($markdown_show); |
Depends you need If you need to remove pre, use a function to stripe it out - strip_tags_only needs to be written $clean_content = str_replace(array("```\n```"), array("```\n"), strip_tags_only($markdown_content, 'pre')); If not and you want to close the tag $clean_content = str_replace(array("```\n```", "```\n<pre"), array("```\n</pre>", "\n<pre"), $markdown_content); a work around of this bug for now. |
I have done a better solution which I want to share $html_content = $post['content']['rendered'];
$html_remove_code_tag = strip_tags_only($html_content, array('code'));
$html_pre_to_code_tag = str_replace(array('<pre','</pre>'), array('<pre><code','</code></pre>'), $html_remove_code_tag);
$markdown_content = $daextulmap_converter->convert( $html_pre_to_code_tag );
$echo $markdown_content; I think it's better that the library does this. but for now. it works. |
I think this issue comes from this line
It's not considering any attributes the pre tag could have like it's done in here
I might be able to submit a PR later |
Fixed in version 5.1.1 |
Version(s) affected
5.0.2
Description
How to reproduce
html
after convert
The text was updated successfully, but these errors were encountered: