aramk / crayon-syntax-highlighter

Syntax Highlighter supporting multiple languages, themes, fonts, highlighting from a URL, local file or post text.
https://wordpress.org/plugins/crayon-syntax-highlighter/
GNU General Public License v3.0
1.1k stars 248 forks source link

Don't put inline code in <pre> tags in feeds. #104

Open kzemek opened 11 years ago

kzemek commented 11 years ago

Hey, Currently cryon-syntax-highlighter puts all code in <pre> tags when it detects that it's in the feed mode: crayon_wp.class.php:666

if (is_feed()) { // Convert the plain code to entities and put in a <pre></pre> tag $crayon_formatted = CrayonFormatter::plain_code($crayon->code(), $crayon->setting_val(CrayonSettings::DECODE)); } else {

This is incorrect for inline snippets, as <pre> is a block, and inline snippets often occur inside <p> tags. <pre> causes the newline to appear after the snippet, which in turn causes a major readability issue for RSS aggregates such as http://planetkde.org/.

zefanja commented 6 years ago

Are there any updates or workarounds for this issue?

aramk commented 6 years ago

If you try and modify this condition to if (is_feed() && !$crayon->is_inline()) { does it fix the issue?