Last active
November 22, 2021 16:05
-
-
Save Its-Just-Nans/aaab58eff030a0c726676405176c374e to your computer and use it in GitHub Desktop.
ShowDownJS problem with &
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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've found a solution. Thank you very much 😀
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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