question for <code> tag
Suna-Wang opened this issue · comments
I wrote a test case to test the code tag, the case is followed:
public void pre_code_test12() {
String output = pre(
code("#include <iostream>" +
"void main(){" +
"cout << "Hello!" << end1;" +
"}")
).render();
}
What I expected is
#include <iostream>void main(){cout << "Hello!" << end1;}
But the output is
#include <iostream>void main(){cout << "Hello!" << end1;}
Then the output will be different from the real need.
expected:
#include void main(){cout << "Hello!" << end1;}
output:
#include <iostream>void main(){cout << "Hello!" << end1;}
How can I produce what I want?
@Suna-Wang j2html provides automatic text escaping in most cases. For your example you can use:
pre( code("#include <iostream>void main(){cout << "Hello!" << end1;}") ).render()
which will produce this html:
<pre><code>#include <iostream>void main(){cout << "Hello!" << end1;}</code></pre>
which the browser should render into the output you desired.
Thank you very much!~