gpt4 book ai didi

javascript - 如何将 Stack 的编辑器正确集成到我的网站中?

转载 作者:行者123 更新时间:2023-12-05 00:37:19 25 4
gpt4 key购买 nike

我正在尝试集成 Stack's editor在我自己写的博客中。但即使在他们的自述文件中的示例中,它也没有显示编辑器。

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title><link rel="stylesheet" href="https://unpkg.com/@stackoverflow/stacks/dist/css/stacks.min.css" />
<script src="https://unpkg.com/@stackoverflow/stacks/dist/js/stacks.min.js"></script>
<script src="//unpkg.com/@highlightjs/cdn-assets@latest/highlight.min.js"></script>
</head>
<body>
<div id="editor-container"></div>
<script>
new window.stacksEditor.StacksEditor(
document.querySelector("#editor-container"),
"*Your* **markdown** here",
{}
);
</script>
</body>
</html>
在这里,浏览器的控制台显示 stacksEditor .

最佳答案

调整了你的代码。您错过了脚本标签中的一些库,从不同的 CDN 添加了它们

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="https://unpkg.com/@stackoverflow/stacks/dist/css/stacks.min.css">
<link rel="stylesheet" href="https://unpkg.com/@stackoverflow/stacks-editor/dist/styles.css">

<script src="https://unpkg.com/@stackoverflow/stacks/dist/js/stacks.min.js"></script>
<script src="https://unpkg.com/@highlightjs/cdn-assets@latest/highlight.min.js"></script>
<script src="https://unpkg.com/@stackoverflow/stacks-editor/dist/app.bundle.js"></script>
</head>

<body>
<div id="editor-container"></div>
<script>
new window.stacksEditor.StacksEditor(
document.querySelector("#editor-container"),
"*Your* **markdown** here", {}
);
</script>
</body>

</html>

关于javascript - 如何将 Stack 的编辑器正确集成到我的网站中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67540072/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com