Skip to content

Strip Markdown markers when pasting content into doc title #13652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TCOTC opened this issue Dec 28, 2024 · 7 comments
Closed

Strip Markdown markers when pasting content into doc title #13652

TCOTC opened this issue Dec 28, 2024 · 7 comments
Assignees
Milestone

Comments

@TCOTC
Copy link
Contributor

TCOTC commented Dec 28, 2024

复制正文内容粘贴到标题时,应去除 Markdown 标记符

一般带 Markdown 标记符是不符合用户预期的,除非用户粘贴的就是带 Markdown 标记符的纯文本。


如果要保留标记符粘贴,应当先粘贴到代码块里再复制带 Markdown 标记符的纯文本粘贴到标题。

然后就有一个问题,将“带 Markdown 标记符的纯文本” 粘贴为纯文本 之后会去除 Markdown 标记符而不是保留原状。

@88250
Copy link
Member

88250 commented Dec 28, 2024

(但不等于粘贴纯文本)

这里没看懂

然后就有一个问题,将“带 Markdown 标记符的纯文本” 粘贴为纯文本 之后会去除 Markdown 标记符而不是保留原状。

用粘贴转义文本

@TCOTC
Copy link
Contributor Author

TCOTC commented Dec 28, 2024

严格来说带标记符的才是纯文本,粘贴到标题时默认粘贴纯文本的话不太对,所以只能说是去除 Markdown 标记符的文本

image

但又不是简单地去除标记符,因为纯文本也可以有标记符,要让粘贴纯文本的时候能保留标记符。

@88250
Copy link
Member

88250 commented Dec 29, 2024

那定义不太一样,思源里面定义的纯文本是去掉标记符的。

粘贴到文档标题时默认用纯文本应该比较符合用户预期。

@Vanessa219
Copy link
Member

粘贴处理的话都是使用的纯文本,因为没有 api 可以读取到 text/html

@TCOTC
Copy link
Contributor Author

TCOTC commented Dec 29, 2024

这样的话那就改成粘贴时纯文本去除 Markdown 标记符吧

@TCOTC TCOTC changed the title 复制正文内容粘贴到标题时,应去除 Markdown 标记符 (但不等于粘贴纯文本) 复制正文内容粘贴到标题时,应去除 Markdown 标记符 Dec 29, 2024
Vanessa219 added a commit that referenced this issue Dec 30, 2024
@Vanessa219 Vanessa219 reopened this Dec 30, 2024
@Vanessa219 Vanessa219 added this to the 3.1.18 milestone Dec 30, 2024
@88250 88250 changed the title 复制正文内容粘贴到标题时,应去除 Markdown 标记符 Strip Markdown markers when pasting content into doc title Dec 30, 2024
Vanessa219 added a commit that referenced this issue Dec 30, 2024
@TCOTC
Copy link
Contributor Author

TCOTC commented Dec 30, 2024

现在直接粘贴是去除标记符,那粘贴纯文本就改成原样保留标记符吧

@88250
Copy link
Member

88250 commented Jan 1, 2025

不改了不改了,作为标题需要标记符的场景太少了

mouyase pushed a commit to mouyase/siyuan that referenced this issue Feb 28, 2025
mouyase pushed a commit to mouyase/siyuan that referenced this issue Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants