A tool helps to convert url to markdown style url format
Project description
Markdown-URL-to-Title
本工具的功能为:自动提取剪贴板中的 URL ,然后使用 requests 获取目标 URL 的标题,根据标题生成可直接粘贴的 Markdown 内容。
背景
在使用 Hexo 写博客的时候,想给博文里插入一些参考文献,但是如果直接粘贴 URL 的话, 有的参考链接的 URL 非常长,而且会被 URL 编码,不太容易阅读,如下:
## 参考文献
* https://vi.stackexchange.com/questions/14114/paste-link-to-image-in-clipboard-when-editing-markdown
* https://c.m.163.com/news/a/FJ8PBOJ000097U7R.html?spss=adap_pc&referFrom=&spssid=592b2c22f7c667bdd783e7ef59625b86&spsw=1&isFromH5Share=article
所以就想着能不能为 Hexo 实现一个自动将 URL 转为 Markdown 带有标题文本的格式,也就是如下:
## 参考文献
* [Paste link to image in clipboard when editing Markdown - Vi and Vim Stack Exchange](https://vi.stackexchange.com/questions/14114/paste-link-to-image-in-clipboard-when-editing-markdown)
* [继微信封禁WeTool后 腾讯或大规模封禁第三方QQ机器人](https://c.m.163.com/news/a/FJ8PBOJ000097U7R.html?spss=adap_pc&referFrom=&spssid=592b2c22f7c667bdd783e7ef59625b86&spsw=1&isFromH5Share=article)
经过一番搜索暂时没有找到解决方案,没有办法,只好出此下策,使用 Python 来对剪切板进行操作,提取剪切板中的 URL 并转换为 Markdown 的格式。
环境需求
- Windows 10
- Python 3
例子
剪切板输入
...
https://baidu.com/
...
剪切板输出
...
[百度一下,你就知道](https://www.baidu.com/)
...
安装
通过 PyPi
pip install u2t
通过 GitHub
git clone https://github.com/WangYihang/Markdown-URL-to-Title
使用方式
- 打开终端,运行:
u2t
,此时系统托盘出现图标 - 复制待处理文本,不用特别精确地只复制 URL,本程序使用正则提取剪切板内容中的所有 URL 并进行批量处理
- 按快捷键 Ctrl + Shift + Q
- 等待数秒,待 Windows 弹出 Toast 提示框,即可直接进行粘贴
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
u2t-1.0.3.tar.gz
(9.8 kB
view details)
Built Distribution
u2t-1.0.3-py3-none-any.whl
(10.7 kB
view details)
File details
Details for the file u2t-1.0.3.tar.gz
.
File metadata
- Download URL: u2t-1.0.3.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 775e650cfc06a5979157e344bb85fa43a0660102368e41afdd199854ca9a008e |
|
MD5 | 6a8a2c0809a9eae574215dff7c0e0015 |
|
BLAKE2b-256 | d8818b4555804330a46d9987b2e36d8ddfc044f5a10f975e122edeba24cc147d |
File details
Details for the file u2t-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: u2t-1.0.3-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ebcb920a2c8b5511960a3ed3a2c23f2f2d3b97d9fa0fd6bdc2771a7f84eabb0 |
|
MD5 | d1fb74781fa9a4c788d07d9d9f566519 |
|
BLAKE2b-256 | e85ff45c355b3b5ef2c449684fbe4b453230c6d492caae1f3446bc3da0fc1d55 |