I'm facing an issue while writing a markdown document.
I'd like to insert a diff code output from the console, containing colors, transformed to HTML via a script, something like this:
# Some title
The following code as been updated:
<pre>
<code>
<span style="color:green;">+</span><span style="color:green;"> if ($url !== $newUrl) {</span>
<span style="color:green;">+</span><span style="color:green;"> $newDomain = parse_url($newUrl, PHP_URL_HOST);</span>
</code>
</pre>
**Thank you**
I've added some Markdown just to show some context.
The problem is, using pre
/code
, the code structure is correct (correctly formated lines).
If I change it (switching to code
/pre
), or changing code
or pre
to div
, I loose either the line breaks, or the coloration.
Here's the output of the above markdown: https://fiddle.md/tmvmwvztfd5d92xk65dwfx
I know that Github have a
diff
expression who let you do something like this : https://gist.github.com/salmedina/ad8bea4f46de97ea132f71b0bca73663#file-markdowndiffexample-mdBut I thinks that there is no such way to do what your want in Markdown.
Regards.