如果您使用的是 Chrome 桌面版,可以使用 Ctrl+Shift+V 来以纯文本形式粘贴,而不是使用记事本。
此外,在管理站点的设置页面中,您可以通过取消勾选“启用富文本粘贴”选项来禁用此高级粘贴行为。
如果您使用的是 Chrome 桌面版,可以使用 Ctrl+Shift+V 来以纯文本形式粘贴,而不是使用记事本。
此外,在管理站点的设置页面中,您可以通过取消勾选“启用富文本粘贴”选项来禁用此高级粘贴行为。
谢谢,但我的目标是保留来自 Microsoft Word 的原始格式(在原始数据中),而不是将其简化为纯文本。
目前,Discourse 会移除多种格式——例如字体大小和字体类型,而保留其他格式(加粗和斜体似乎得以保留)。作为对比,Gmail 编辑器似乎保留了所有格式。
为了尝试保留更多格式,我想另一种方法是上传 Word 文档(不是将文本粘贴到编辑器中,而是上传实际的文档)。不过,我认为问题在于 Discourse 不会在行内显示上传内容的内容(它仅显示一个上传链接)。
那么请直接粘贴原始 HTML。
这里涉及不同的目标。Gmail 的目标是保留所有格式,而论坛的目标是保留有意义的格式子集,同时防止滥用(如超大文本、闪烁文本、过大的字体、烦人的颜色等)。
作为一个简单的例子,以下是由 Office 生成的一段简单文本的 HTML,它以 text/html 格式存在于剪贴板中:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title></title>
<meta name="generator" content="LibreOffice 7.1.2.2 (Linux)"/>
<style type="text/css">
@page { size: 21.59cm 27.94cm; margin: 2cm }
p { margin-bottom: 0.25cm; line-height: 115%; background: transparent }
</style>
</head>
<body lang="en-CA" link="#000080" vlink="#800000" dir="ltr"><p style="margin-bottom: 0cm; line-height: 100%">
<b>Hello there</b><span style="font-weight: normal"> sunshine </span><i><span style="font-weight: normal">eh</span></i></p>
</body>
</html>
它看起来是这样的:
@page { size: 21.59cm 27.94cm; margin: 2cm } p { margin-bottom: 0.25cm; line-height: 115%; background: transparent }Hello there sunshine eh
但当 to-markdown.js 解析它时,你会得到:
**Hello there** sunshine *eh*
Hello there sunshine eh
你无法做到这一点,除非你像我在本贴中那样手动添加。如果你真的需要它在那里,请将其隐藏在注释中。如果你想稍后自行将其转换为 Markdown,可以使用类似 pandoc 的工具。
我支持在显示给其他人的帖子中转换为 Markdown,以保持某种一致性。我感兴趣的是原始输入内容。
你如何获取 Word 文档的原始 HTML 以便粘贴呢?
将其另存为 Word 中的 HTML,或将其复制到剪贴板,然后从剪贴板中显式提取 text/html。
如果你只是希望能够在稍后引用原始输入,这个组件可能适合你。
它会在帖子菜单中添加一个按钮,按帖子显示原始内容。
@jomaxro,评论的原始标记语法是什么?
您在问什么?您是在问 markdown 是什么吗?比如 https://commonmark.org/ 您是在问如何获取帖子的原始 markdown 吗?比如 /raw/123
对于单个帖子,您可以将 ID 添加到 URL 中。例如,https://meta.discourse.org/raw/189183/27 是您的回复。
@jomaxro,/raw/ 在 discuss.kde.org/c/community/blogs/24 的任何帖子中都无效,因为在 view-source:discuss.kde.org/raw/43656 处,我看到:
<pre>Konqi | 2026-01-23 22:43:37 UTC | #1
<p>Leaking memory is impolite. It’s messy, it can suggest logic bugs, and thanks to AI grifters RAM is expensive.</p>
<hr>
<small>This is a companion discussion topic for the original entry at <a href="https://nicolasfella.de/posts/detecting-leaks-in-kde-ci/?utm_source=atom_feed">https://nicolasfella.de/posts/detecting-leaks-in-kde-ci/?utm_source=atom_feed</a></small>
---------
</pre>
然而,当在 discuss.kde.org/t/43656 上交互式展开 details 时,我可以将其展开为:
这是否可以在上游 Discourse 端得到可行性的支持?我观察到其他略有定制的 Discourse 实例也有类似情况,因此我提出这个问题。
您正试图解决什么问题?
这些主题很特别,因为它们链接到大型帖子。
这是 op 的原始文本。
该主题中 OP 的纯文本如下:
○ → curl https://discuss.kde.org/posts/132565/raw
<p>Leaking memory is impolite. It’s messy, it can suggest logic bugs, and thanks to AI grifters RAM is expensive.
</p>
<hr>
<small>This is a companion discussion topic for the original entry at <a href="https://nicolasfella.de/posts/detecting-leaks-in-kde-ci/?utm_source=atom_feed">https://nicolasfella.de/posts/detecting-leaks-in-kde-ci/?utm_source=atom_feed</a></small>
这与“已渲染”版本中显示的内容完全相同。
这不是展开 details 块。点击 Show Full Post 会加载其他内容,这是嵌入内容的完整展开,它不是来自帖子原始内容,而是来自额外的帖子元数据。
您可以在浏览器中点击它时看到网络请求,等效请求如下:
○ → curl -s -H 'accept: application/json' 'https://discuss.kde.org/posts/132565/expand-embed' | jq -r .cooked
<div><div>
<p>Leaking memory is impolite. It’s messy, it can suggest logic bugs, and thanks to AI grifters RAM is expensive.</p>
…
…
…
<p>LSAN is now enabled for some Frameworks CI builds, but ideally it would be enabled for all KDE projects. And of course any leaks found along the way should be fixed.</p>
<p>Happy leak-fixing!</p>
</div></div>
<hr>
<small>This is a companion discussion topic for the original entry at <a href='https://nicolasfella.de/posts/detecting-leaks-in-kde-ci/?utm_source=atom_feed'>https://nicolasfella.de/posts/detecting-leaks-in-kde-ci/?utm_source=atom_feed</a></small>
您是想查看嵌入内容吗?如果是,请使用上述内容。如果不是,您期望看到什么?
@supermathie,确实如此。非常感谢!显然,我所知道的 Discourse API 远不止这些。