-
-
Save Its-Just-Nans/aaab58eff030a0c726676405176c374e to your computer and use it in GitHub Desktop.
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://unpkg.com/showdown/dist/showdown.min.js"></script> | |
</head> | |
<body> | |
<div id="converted"></div> | |
<pre id="toConvert" style="display:none"> | |
Here some text with & taht is converted | |
```c | |
#include <stdio.h> | |
int main(){ | |
int number = 7; | |
int *pointerTOnumber = &number; | |
} | |
``` | |
</pre> | |
<script> | |
let converter = new showdown.Converter(); | |
let html = converter.makeHtml(document.getElementById('toConvert').innerHTML); | |
document.getElementById('converted').innerHTML = html; | |
</script> | |
</body> | |
</html> |
我也遇到这种情况了,请问你解决这个问题了吗?
I also encountered this situation. Have you solved this problem?
It's because of the pre
tag wich transforms the &
symbol to an &
To counter this, just use showdown in a traditionnal tag like <div>
!
It's because of the
pre
tag wich transforms the&
symbol to an&
To counter this, just use showdown in a traditionnal tag like
<div>
!
那官网里那个textarea里的是可以正常显示的,他们是手动转换了吗?
The textarea on the official website can be displayed normally. Did they switch manually?
https://github.com/aote777/anki-md-template/blob/master/demo.html
这是我写的demo 可以直接运行。
This is the demo I wrote, which can be run directly.
It's because of the
pre
tag wich transforms the&
symbol to an&
To counter this, just use showdown in a traditionnal tag like<div>
!The textarea on the official website can be displayed normally. Did they switch manually
Yes you can use <textarea>
, it's only the <pre>
wich isn't working
Thank you for your answer. But I got the innerHTML value directly, and the character entity was also escaped。
var text = textarea.innerHTML
I don't understand
I've found a solution. Thank you very much 😀
The result of this program is :