Closed hollasch closed 3 months ago
When you insert spaces those get rendered in the final document. To avoid the visible spaces and to prevent the browser from interpreting the less-than sign as the beginning of a tag, you can alternately insert a "Zero Width No-Break Space" unicode character (U+FEFF). The HTML entity escape code for this is 
:
*bptr = static_cast<unsigned char>(*fptr * 256.0);
This gets rendered as expected and without spaces for me (by Chrome, Safari, and Firefox). Note that the second space (before the greater-than sign >
) doesn't seem to be necessary as just separating the less-than sign from a subsequent character seems to be enough to convince the browser that this is not an HTML tag.
Now copy and paste from the listing into your code and try compiling. 😄
(I also tried no-break space, en-space, etc.)
Yeah, copying and pasting becomes an issue with character codes like this.
Another solution that works (according to the Markdeep Demo, Section 1.15.5 is to wrap the code examples (or the entire document) in <script type="preformatted">...</script>
. This seems to make the code render correctly without any special treatment and the copying and pasting seems to work as well.
Ah. Ugly, but another decent (temporary) workaround. Morgan returns from vacation April 4 — let's see what his response is then.
Another solution that works (according to the Markdeep Demo, Section 1.15.5 is to wrap the code examples (or the entire document) in
<script type="preformatted">...</script>
. This seems to make the code render correctly without any special treatment and the copying and pasting seems to work as well.
I tried wrapping the whole document and that didn't work for me. Wrapping individual listings works though.
Anyway, let's wait for Morgan's response.
Here's Morgan's response:
This is caused by the browser parsing that as a HTML tag with an empty attribute before I see the document in Markdeep script. The simplest workaround is to make the input not legal HTML with the space as you found. Another workaround is the one advocated in the demo/manual https://casual-effects.com/markdeep/features.md.html#basicformatting/codeblocks/less-thansignsincode:
use a script tag with "preformatted" to surround either the entire document or the code sample. That prevents the browser from modifying it, and then Markdeep knows to strip the script tag out when processing.
Markdeep currently has a bug where the line
is rendered as
As a workaround, we use
This is in the file
rtw_stb_image.h
. Once this bug is fixed in Markdeep, remove the extraneous spaces inside the angle brackets.