We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Inline `code`! ``` Block of code ```
<p>Inline <code>code</code>!</p> <code>Block of code </code>
We want to highlight the code block, but don't want to do that for inline code. However, in the outputted HTML, they are not distinguishable.
Wrap the <code> inside <pre>. This would (by default):
<code>
<pre>
white-space: pre-wrap
The text was updated successfully, but these errors were encountered:
Implementation is easy:
diff --git a/src/main/php/net/daringfireball/markdown/ToHtml.class.php b/src/main/php/net/daringfireball/markdown/ToHtml.class.php index 5373a6c..6c9ed24 100755 --- a/src/main/php/net/daringfireball/markdown/ToHtml.class.php +++ b/src/main/php/net/daringfireball/markdown/ToHtml.class.php @@ -270,7 +270,7 @@ class ToHtml implements Emitter { } $attr= $block->language ? ' lang="'.htmlspecialchars($block->language, $this->flags).'"' : ''; - return '<code'.$attr.'>'.$r.'</code>'; + return '<pre><code'.$attr.'>'.$r.'</code></pre>'; } /**
However, it breaks BC, so we would have to go for a major release.
Sorry, something went wrong.
Emit code blocks as <code> wrapped in <pre>
abbb8d2
Solves problem described in issue #16
No branches or pull requests
Input
Output
Problem
We want to highlight the code block, but don't want to do that for inline code. However, in the outputted HTML, they are not distinguishable.
Idea
Wrap the
<code>
inside<pre>
. This would (by default):white-space: pre-wrap
The text was updated successfully, but these errors were encountered: