027xiguapi / code-box

本插件可以用于CSDN/知乎/脚本之家/博客园/掘金等网站,一键下载文章html或markdown文件;实现无需登录一键复制代码;支持选中代码;或者代码右上角按钮的一键复制;解除关注博主即可阅读全文提示;去除登录弹窗;去除跳转APP弹窗.
https://chromewebstore.google.com/detail/codebox-%E5%85%8D%E7%99%BB%E5%BD%95%E4%B8%80%E9%94%AE%E5%A4%8D%E5%88%B6%E4%BB%A3%E7%A0%81/acnnhjllgegbndgknlliobjlekgilbdf
GNU General Public License v3.0
2.06k stars 136 forks source link

【掘金】文章下载后,代码格式有问题 #18

Closed xckevin closed 1 month ago

xckevin commented 2 months ago

文档下载后,代码都变成一行了,并且多了一些代码块上的文字。如:

使用代码示例 jsx 代码解读 复制代码

import { useMemo, useState } from "react";import CodeMirror from "rodemirror";import { basicSetup } from "@codemirror/basic-setup";import { oneDark } from "@codemirror/theme-one-dark";import { javascript } from "@codemirror/lang-javascript";import { markdown as langMarkdown } from "@codemirror/lang-markdown";const Editor = () => { const extensions = useMemo(() => [basicSetup, oneDark, javascript(),langMarkdown()], []); const defaultValue = "console.log('Hello world!')"; // remove if you do not need the value const [value, setValue] = useState(defaultValue); return ( <CodeMirror value={defaultValue} onUpdate={(v) => { if (v.docChanged) { setValue(v.state.doc.toString()); } }} extensions={extensions} /> );};export default Editor;

027xiguapi commented 1 month ago

测试地址: https://juejin.cn/post/7403946149914738751