Normal sıralı <code>
kullanım için:
<code>...</code>
ve engellenen her yer <code>
için
<code style="display:block; white-space:pre-wrap">...</code>
Alternatif olarak, <codenza>
astar astar bloğu için bir etiket tanımlayın <code>
(sınıf yok)
<script>
</script>
<style>
codenza, code {} /* noop mnemonic aide that codenza mimes code tag */
codenza {display:block;white-space:pre-wrap}
</style>`
Test: (Not: aşağıdaki, bir data:
URI protokolü / şeması kullanan bir scurIple'dir , bu nedenle %0A
nl format kodları, test edilmek üzere URL çubuğuna kesilip yapıştırıldığında bu şekilde korunmada önemlidir - bu nedenle view-source:
( ctrl- U) aşağıdaki her satırda iyi görünür %0A
)
data:text/html;charset=utf-8,<html >
<script>document.write(window.navigator.userAgent)</script>
<script></script>
<style>
codenza, code {} /* noop mnemonic aide that codenza mimes code tag */
codenza {display:block;white-space:pre-wrap}
</style>
<p>First using the usual <code> tag
<code>
%0A function x(arghhh){
%0A return "a very long line of text that will extend the code beyond the boundaries of the margins, guaranteed for the most part, well maybe without you as a warrantee (except in abnormally conditioned perverse environs in which case a warranty is useless)"
%0A }
</code>
and then
<p>with the tag blocked using pre-wrapped lines
<code style=display:block;white-space:pre-wrap>
%0A function x(arghhh){
%0A return "a very long line of text that will extend the code beyond the boundaries of the margins, guaranteed for the most part, well maybe without you as a warrantee (except in abnormally conditioned perverse environs in which case a warranty is useless)"
%0A }
</code>
<br>using an ersatz tag
<codenza>
%0A function x(arghhh){
%0A return "a very long line of text that will extend the code beyond the boundaries of the margins, guaranteed for the most part, well maybe without you as a warrantee (except in abnormally conditioned perverse environs in which case a warranty is useless)"
%0A }
</codenza>
</html>