Comments (12)
3.0.13依旧是复制网页元素,截图:
如果是单单是复制<span class="pre">capture_stdout=True,</span><span> </span><span class="pre">stderr=subprocess.STDOUT</span>
到剪切板就没问题,如果网页元素周围有文本时就不行了
不知道你用的是什么解析剪切板的富文本信息,剪切板都是HTML富文本形式,操作截图:
import win32clipboard
def GetAvailableFormats():
"""
Return a possibly empty list of formats available on the clipboard
返回剪切板可能有的一些格式
"""
formats = []
try:
win32clipboard.OpenClipboard(0)
cf = win32clipboard.EnumClipboardFormats(0)
while (cf != 0):
formats.append(cf)
cf = win32clipboard.EnumClipboardFormats(cf)
finally:
win32clipboard.CloseClipboard()
return formats
# CF_HTML=49433
CF_HTML = win32clipboard.RegisterClipboardFormat("HTML Format")
if CF_HTML in GetAvailableFormats():
win32clipboard.OpenClipboard(0)
src = win32clipboard.GetClipboardData(CF_HTML)
src = src.decode("UTF-8")
print(src)
else:
print("当前剪切板没有富文本内容")
完整的剪切板内容输出:
C:\ProgramData\anaconda3\envs\python311\python.exe C:\Users\Administrator\Personal_scripts\pythonProject\temp.py
Version:0.9
StartHTML:0000000200
EndHTML:0000004248
StartFragment:0000000236
EndFragment:0000004212
SourceURL:https://trio.readthedocs.io/en/stable/reference-io.html#asynchronous-filesystem-i-o
<html>
<body>
<!--StartFragment--><span style="color: rgb(64, 64, 64); font-family: Lato, proxima-nova, "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(252, 252, 252); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">如果要同时捕获 stdout 和 stderr,但要按打印顺序将它们混合在一起,请使用:<span> </span></span><code class="docutils literal notranslate" data-immersive-translate-walked="a926668a-d38b-4e1e-824c-535ff2a6205f" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", Courier, monospace; font-size: 12px; white-space: normal; max-width: 100%; background: rgb(255, 255, 255); border: 1px solid rgb(225, 228, 229); padding: 2px 5px; color: rgb(34, 34, 34) !important; overflow-x: auto; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span class="pre" style="box-sizing: border-box;">capture_stdout=True,</span><span> </span><span class="pre" style="box-sizing: border-box;">stderr=subprocess.STDOUT</span></code><span style="color: rgb(64, 64, 64); font-family: Lato, proxima-nova, "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(252, 252, 252); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"><span> </span>。这会将子项的 stderr 引导到其 stdout,因此组合输出将在属性中<span> </span></span><code class="xref py py-obj docutils literal notranslate" data-immersive-translate-walked="a926668a-d38b-4e1e-824c-535ff2a6205f" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", Courier, monospace; font-size: 12px; white-space: normal; max-width: 100%; background: rgb(255, 255, 255); border: 1px solid rgb(225, 228, 229); padding: 2px 5px; color: rgb(34, 34, 34) !important; overflow-x: auto; font-weight: 700; overflow-wrap: normal; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span class="pre" style="box-sizing: border-box;">stdout</span></code><span style="color: rgb(64, 64, 64); font-family: Lato, proxima-nova, "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(252, 252, 252); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"><span> </span>可用</span><!--EndFragment-->
</body>
</html>
进程已结束,退出代码为 0
表格在代码其中:
<span style="color: rgb(64, 64, 64); font-family: Lato, proxima-nova, "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(252, 252, 252); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">如果要同时捕获 stdout 和 stderr,但要按打印顺序将它们混合在一起,请使用:<span> </span></span><code class="docutils literal notranslate" data-immersive-translate-walked="a926668a-d38b-4e1e-824c-535ff2a6205f" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", Courier, monospace; font-size: 12px; white-space: normal; max-width: 100%; background: rgb(255, 255, 255); border: 1px solid rgb(225, 228, 229); padding: 2px 5px; color: rgb(34, 34, 34) !important; overflow-x: auto; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span class="pre" style="box-sizing: border-box;">capture_stdout=True,</span><span> </span><span class="pre" style="box-sizing: border-box;">stderr=subprocess.STDOUT</span></code><span style="color: rgb(64, 64, 64); font-family: Lato, proxima-nova, "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(252, 252, 252); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"><span> </span>。这会将子项的 stderr 引导到其 stdout,因此组合输出将在属性中<span> </span></span><code class="xref py py-obj docutils literal notranslate" data-immersive-translate-walked="a926668a-d38b-4e1e-824c-535ff2a6205f" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", Courier, monospace; font-size: 12px; white-space: normal; max-width: 100%; background: rgb(255, 255, 255); border: 1px solid rgb(225, 228, 229); padding: 2px 5px; color: rgb(34, 34, 34) !important; overflow-x: auto; font-weight: 700; overflow-wrap: normal; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span class="pre" style="box-sizing: border-box;">stdout</span></code><span style="color: rgb(64, 64, 64); font-family: Lato, proxima-nova, "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(252, 252, 252); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"><span> </span>可用</span>
table代码直接粘贴到Github的MD编辑器就显示成表格:
如果要同时捕获 stdout 和 stderr,但要按打印顺序将它们混合在一起,请使用: capture_stdout=True, stderr=subprocess.STDOUT
。这会将子项的 stderr 引导到其 stdout,因此组合输出将在属性中 stdout
可用
操作截图:
善用富文本,MD写作笔记中的富文本地位很高
from siyuan.
我这里测试正文中提到的网页 DOM 结构已经没有问题:
issue.webm
其他网页的话麻烦单独提 issue 进行改进,谢谢。
from siyuan.
其他网页的话麻烦单独提 issue 进行改进,谢谢。
from siyuan.
收到,这种情况下个版本改进,谢谢。
from siyuan.
是否有考虑:
每个块/页面的添加纯文本模式
和即时预览模式
?(每个块当成单独的编辑框,类似Issue编辑某个评论就弹出编辑框)- 每个块支持HTML元素展示,以及更丰富的MD语法支持
Github的Issue编辑框的Write
和Preview
按钮,粘贴HTML元素后,切为Preview
模式就能立刻显示,Github的编辑框特性是挺实用的,优点:
其它:
创建表格,若编辑标点在表格末尾,连按Enter几次没什么反应,不是很符合用户直觉,Enter应该改成连按2次就退出表格切换到下一个块(相当于ctrl+shift+A)
from siyuan.
思源笔记的编辑器不是 Markdown 编辑器,所以不考虑源码编辑模式。
@Vanessa219 表格最后一行 Enter 跳出创建新块考虑一下。
from siyuan.
思源笔记的编辑器不是 Markdown 编辑器,所以不考虑源码编辑模式。
自研编辑器?那更多的MD语法还考虑支持吗?😬
from siyuan.
from siyuan.
复制Github的引用链接出错,无法转为[subject:matches-attr(arg)](https://github.com/siyuan-note/siyuan/issues/11281)
from siyuan.
这个 a 标签的锚文本是个 svg,编辑器进行处理,所以导致锚文本为空,从而无法转换渲染为正常的超链接:
下个版本会改进为直接丢弃锚文本为空的超链接元素。
from siyuan.
这时候就体现富文本HTML的优势了,放到Github编辑框能自动显示为合适的格式,siyuan应该添加富文本/HTML支持,这样无论下次剪切/复制什么内容,siyuan就直接读取HTML转为合适的格式
剪切板的问题陆陆续续遇到了好几次,这次解决了,但下次又双叒叕遇到了咋办😂
from siyuan.
from siyuan.
Related Issues (20)
- Improve dynamic scroll bar HOT 1
- Improve embed/ref block reindex HOT 1
- `/标签` 和 `Ctrl+T` 支持标签搜索
- Improve `Enter` in the last row of the table
- Support cancel two-way relation when related to the current database HOT 4
- If a file with the same name exists during export PDF/Docx, it will be automatically renamed HOT 13
- 导出目录下存在同名文件,需要提示 HOT 1
- Improve the cursor when two images are connected
- Supports outline highlight with document sync on the mobile
- Improve two-way relation column name placeholder
- Undo exception after Delete in the last line of the code block HOT 3
- 点击数据库导致页面微量移动 HOT 8
- kernel supports read-only publishing services HOT 5
- 怎么限制数据库换行文本的最大行数? HOT 20
- 退格键后光标位置与常规方式不符 HOT 1
- Improve `Display the VIP icon` HOT 23
- Message Dialog on Startup HOT 2
- Improve HTML inline code clipping
- Add the database attribute dock panel HOT 88
- Improve export preview mode
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from siyuan.