Comments (9)
Would you consider making the extension handle more complex paste-types (regardless of platform/language/localisation), so as to meet with the reporting user's expectations?
Have a look at how clipboard2markdown works.
Complex Clipboard type handling code
A more detailed explanation of how it works
I'd raise a PR with some nice recursion to handle inlining images from within Web-page copies, but I'm maxed-out at work at the moment.
from vscode-markdown-paste-image.
@JeffersonQin
转换HTML tag为Markdown的功能没问题呀,你发的图里也没包含html tag。
from vscode-markdown-paste-image.
嘶.... 我是复制的浏览器的内容,理论上剪切板中应该包含HTML tag的(Windows下测试的)
from vscode-markdown-paste-image.
我举个例子:
下图是我复制的内容:
下图是剪切板的输出:
命令:
Get-Clipboard -TextFormatType Html
from vscode-markdown-paste-image.
由于我不用Windows和Mac,目前只完成了Linux中把HTML转换为Markdown的功能。我曾经尝试过在Windows中使用powershell去获取剪贴板中的内容,但是当时windows中有一个bug,如果剪贴板内容中有中文或日文字符时,将剪贴板中的文本转换为UTF编码会出现非法字符,导致无法取出正确的剪贴板内容,所以就放弃了。
目前如果在windows下想使用HTML转换为Markdown的功能,可以通过直接拷贝HTML的代码,然后用插件粘贴到markdown里,插件会判断粘贴的文本中是否带有html的tag的标记,如果有它就会尝试转换。
from vscode-markdown-paste-image.
我找到解决办法了。这两天正好在写WPF,之前也接触过Clipboard类,可以用类似的办法:即,WPF (.NET) 封装好的函数来调Clipboard
代码:
Add-Type -Assembly PresentationCore
[Windows.Clipboard]::GetData([Windows.DataFormats]::Html)
Reference:
- https://docs.microsoft.com/en-us/dotnet/api/system.windows.dataformats?view=net-5.0
- https://www.cnblogs.com/guogangj/p/7465951.html
- https://blog.vichamp.com/2014/07/21/forward-chinese-text-into-clipboard/
from vscode-markdown-paste-image.
您这边不方便用win对吧,这个反正也不急,我过两天有时间研究一下写一下,提个PR上了,到时候麻烦您看一下
from vscode-markdown-paste-image.
@JeffersonQin
太感谢了!!!
from vscode-markdown-paste-image.
@lukebrowell
This extension also use to-markdown lib to convert html to markdown too, but it only work on Linux. Vscode is not a web browser, it seem does not support document.addEventListener API, so it is a troublesome thing to get complex clipboard type in vscode.
from vscode-markdown-paste-image.
Related Issues (20)
- Default name to be YYYY-MM-DD_HH-mm-ss_<selected text> HOT 2
- Use in VSCode for the Web
- Add option for default alt text HOT 1
- Add ability to upload to `user-images.githubusercontent.com` similar to how GitHub does in READMEs and comments
- Mac OS Ventura: Command not found HOT 3
- Linux: Wayland support
- Paste cannot work HOT 3
- Not work in WSL mode, showing "Clipboard Type Unknown" HOT 3
- Add an option for set the name of the image HOT 1
- FYI, VS Code built in markdown extension is good enough HOT 1
- How to customize the way HTML is converted to Markdown? HOT 2
- Variable expansion in rules and Lang-rules HOT 2
- 多出来的 ** HOT 4
- The drive letter of Windows paste path should be in uppercase HOT 1
- Can't work in vscode-insider HOT 1
- Add SECURITY.md HOT 2
- Not working in Code on Debain or Ubuntu but works in Code on Windows 11 HOT 3
- Allow execution of extension in .Rmd files
- No support for image paste inside GitHub issues?
- Why there are spaces after the pasted image?
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 vscode-markdown-paste-image.