|
|
@@ -20,7 +20,7 @@ const render = (fileName) => {
|
|
|
fetch(`/demo/markdown/${fileName}.md`).then(response => response.text()).then(markdown => {
|
|
|
|
|
|
Vditor.preview(previewElement, markdown, {
|
|
|
- cdn: 'http://localhost:9000',
|
|
|
+ cdn: 'https://cdn.jsdelivr.net/npm/vditor',
|
|
|
markdown: {
|
|
|
toc: true, listStyle: fileName === 'cute-list',
|
|
|
},
|
|
|
@@ -36,7 +36,7 @@ const render = (fileName) => {
|
|
|
outlineElement.style.display = 'block'
|
|
|
}
|
|
|
},
|
|
|
- lazyLoadImage: 'https://unpkg.com/vditor/dist/images/img-loading.svg',
|
|
|
+ lazyLoadImage: 'https://cdn.jsdelivr.net/npm/vditor/dist/images/img-loading.svg',
|
|
|
renderers: {
|
|
|
renderHeading: (node, entering) => {
|
|
|
const id = Lute.GetHeadingID(node)
|
|
|
@@ -55,12 +55,12 @@ render('zh_CN')
|
|
|
window.setTheme = (theme) => {
|
|
|
if (theme === 'dark') {
|
|
|
Vditor.setCodeTheme('native')
|
|
|
- Vditor.setContentTheme('dark', 'https://unpkg.com/vditor/dist/css/content-theme')
|
|
|
+ Vditor.setContentTheme('dark', 'https://cdn.jsdelivr.net/npm/vditor/dist/css/content-theme')
|
|
|
outlineElement.classList.add('dark')
|
|
|
document.querySelector('html').style.backgroundColor = '#2f363d'
|
|
|
} else {
|
|
|
Vditor.setCodeTheme('github')
|
|
|
- Vditor.setContentTheme('light', 'https://unpkg.com/vditor/dist/css/content-theme')
|
|
|
+ Vditor.setContentTheme('light', 'https://cdn.jsdelivr.net/npm/vditor/dist/css/content-theme')
|
|
|
outlineElement.classList.remove('dark')
|
|
|
document.querySelector('html').style.backgroundColor = '#fff'
|
|
|
}
|