ccccccccccccccccccc

This commit is contained in:
aote777 2021-11-23 17:46:32 +08:00
parent d6f508bf73
commit 350fef1402
1 changed files with 19 additions and 1 deletions

View File

@ -6,6 +6,21 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>anki-md模板测试</title> <title>anki-md模板测试</title>
</head> </head>
<!-- <style>
.markdown-body {
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 45px;
}
@media (max-width: 767px) {
.markdown-body {
padding: 15px;
}
}
</style> -->
<body> <body>
<textarea class="md-content"> <textarea class="md-content">
* 哈哈 * 哈哈
@ -128,6 +143,7 @@ function consoleLog(str) {
var newDiv = document.createElement('div') var newDiv = document.createElement('div')
var hr = document.createElement('hr') var hr = document.createElement('hr')
newDiv.innerHTML = html newDiv.innerHTML = html
newDiv.className = 'markdown-body'
textarea.parentNode.insertBefore(newDiv, textarea.nextSibling) textarea.parentNode.insertBefore(newDiv, textarea.nextSibling)
index === 1 index === 1
@ -138,8 +154,9 @@ function consoleLog(str) {
// 不能从body直接插入元素 anki 不刷新的 淦 // 不能从body直接插入元素 anki 不刷新的 淦
}) })
} }
createLink(highLightCss)
createLink(githubMarkdownCss) createLink(githubMarkdownCss)
createLink(highLightCss)
createScript(showDownCdn) createScript(showDownCdn)
.then(() => { .then(() => {
return createScript(highLightJs) return createScript(highLightJs)
@ -156,6 +173,7 @@ function consoleLog(str) {
}) })
}) })
.then(() => { .then(() => {
// 自动代码高亮
hljs.highlightAll() hljs.highlightAll()
return new Promise((resolve) => { return new Promise((resolve) => {
resolve() resolve()