All Projects → mushanshitiancai → Vscode Paste Image

mushanshitiancai / Vscode Paste Image

Licence: mit
paste image from clipboard to markdown/asciidoc directly!

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Vscode Paste Image

Markor
Text editor - Notes & ToDo (for Android) - Markdown, todo.txt, plaintext, math, ..
Stars: ✭ 1,394 (+490.68%)
Mutual labels:  markdown, clipboard
Yn
Yank Note 一款面向程序员的 Markdown 笔记应用。支持加密文档,代码片段运行,内置终端,图表嵌入,HTML 小工具。
Stars: ✭ 143 (-39.41%)
Mutual labels:  markdown, vscode
Dendron
The personal knowledge management (PKM) tool that grows as you do!
Stars: ✭ 2,538 (+975.42%)
Mutual labels:  markdown, vscode
Foam
A personal knowledge management and sharing system for VSCode
Stars: ✭ 10,993 (+4558.05%)
Mutual labels:  markdown, vscode
Qimage Win
Windows 版本 Markdown 一键贴图工具,支持本地文件、截图、网络图片一键上传七牛云并返回图片引用,让 Markdown 中贴图变成一种享受。
Stars: ✭ 196 (-16.95%)
Mutual labels:  markdown, image
Vscode Yuml
yUML extension for Visual Studio Code
Stars: ✭ 102 (-56.78%)
Mutual labels:  markdown, vscode
Honkit
📖 HonKit is building beautiful books using Markdown - Fork of GitBook
Stars: ✭ 1,901 (+705.51%)
Mutual labels:  markdown, asciidoc
Mybox
Easy tools of document, image, file, network, location, color, and media.
Stars: ✭ 45 (-80.93%)
Mutual labels:  markdown, image
Markdown Img Paste
一个可以快速粘贴剪贴板里的照片到markdown的插件,并且可以设置使用七牛存储照片。
Stars: ✭ 176 (-25.42%)
Mutual labels:  markdown, image
Cli
A command line utility for Structurizr.
Stars: ✭ 173 (-26.69%)
Mutual labels:  markdown, asciidoc
Qimage Mac
Mac 版本的 Markdown 一键贴图工具,基于 Alfred 实现,支持本地文件、截图、网络图片一键上传七牛云,使用简单方便
Stars: ✭ 99 (-58.05%)
Mutual labels:  markdown, image
Jekyll Spaceship
🚀 A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, mermaid, emoji, video, audio, youtube, vimeo, dailymotion, soundcloud, spotify, etc.
Stars: ✭ 196 (-16.95%)
Mutual labels:  markdown, image
Kramdown Asciidoc
A kramdown extension for converting Markdown documents to AsciiDoc.
Stars: ✭ 97 (-58.9%)
Mutual labels:  markdown, asciidoc
Vscode Mdx Preview
MDX Preview for Visual Studio Code
Stars: ✭ 103 (-56.36%)
Mutual labels:  markdown, vscode
Vim Pencil
Rethinking Vim as a tool for writing
Stars: ✭ 1,186 (+402.54%)
Mutual labels:  markdown, asciidoc
Paste Markdown
Paste spreadsheet cells as a Markdown table.
Stars: ✭ 119 (-49.58%)
Mutual labels:  markdown, clipboard
Vscode Markdown Pdf
Markdown converter for Visual Studio Code
Stars: ✭ 571 (+141.95%)
Mutual labels:  markdown, vscode
Remark Defsplit
plugin to change links and images to references with separate definitions
Stars: ✭ 7 (-97.03%)
Mutual labels:  markdown, image
Vscode Markdown
Markdown All in One
Stars: ✭ 2,113 (+795.34%)
Mutual labels:  markdown, vscode
Swagger2markup
A Swagger to AsciiDoc or Markdown converter to simplify the generation of an up-to-date RESTful API documentation by combining documentation that’s been hand-written with auto-generated API documentation.
Stars: ✭ 2,330 (+887.29%)
Mutual labels:  markdown, asciidoc

Paste Image

Paste image directly from clipboard to markdown/asciidoc(or other file)!

Support Mac/Windows/Linux! And support config destination folder.

paste-image

Now you can enable pasteImage.showFilePathConfirmInputBox to modify file path before save:

confirm-inputbox

Usage

  1. capture screen to clipboard
  2. Open the command palette: Ctrl+Shift+P (Cmd+Shift+P on Mac)
  3. Type: "Paste Image" or you can use default keyboard binding: Ctrl+Alt+V (Cmd+Alt+V on Mac).
  4. Image will be saved in the folder that contains current editing file
  5. The relative path will be paste to current editing file

Config

  • pasteImage.defaultName

    The default image file name.

    The value of this config will be pass to the 'format' function of moment library(a js time manipulation library), you can read document https://momentjs.com/docs/#/displaying/format/ for advanced usage.

    And you can use variable:

    • ${currentFileName}: the current file name with ext.
    • ${currentFileNameWithoutExt}: the current file name without ext.

    Default value is Y-MM-DD-HH-mm-ss.

  • pasteImage.path

    The destination to save image file.

    You can use variable:

    • ${currentFileDir}: the path of directory that contain current editing file.
    • ${projectRoot}: the path of the project opened in vscode.
    • ${currentFileName}: the current file name with ext.
    • ${currentFileNameWithoutExt}: the current file name without ext.

    Default value is ${currentFileDir}.

  • pasteImage.basePath

    The base path of image url.

    You can use variable:

    • ${currentFileDir}: the path of directory that contain current editing file.
    • ${projectRoot}: the path of the project opened in vscode.
    • ${currentFileName}: the current file name with ext.
    • ${currentFileNameWithoutExt}: the current file name without ext.

    Default value is ${currentFileDir}.

  • pasteImage.forceUnixStyleSeparator

    Force set the file separator style to unix style. If set false, separator style will follow the system style.

    Default is true.

  • pasteImage.prefix

    The string prepend to the resolved image path before paste.

    Default is "".

  • pasteImage.suffix

    The string append to the resolved image path before paste.

    Default is "".

  • pasteImage.encodePath

    How to encode image path before insert to editor. Support options:

    • none: do nothing, just insert image path to text
    • urlEncode: url encode whole image path
    • urlEncodeSpace: url encode only space character(space to %20)

    Default is urlEncodeSpace.

  • pasteImage.namePrefix

    The string prepend to the image file name.

    You can use variable:

    • ${currentFileDir}: the path of directory that contain current editing file.
    • ${projectRoot}: the path of the project opened in vscode.
    • ${currentFileName}: the current file name with ext.
    • ${currentFileNameWithoutExt}: the current file name without ext.

    Default is "".

  • pasteImage.nameSuffix

    The string append to the image name.

    You can use variable:

    • ${currentFileDir}: the path of directory that contain current editing file.
    • ${projectRoot}: the path of the project opened in vscode.
    • ${currentFileName}: the current file name with ext.
    • ${currentFileNameWithoutExt}: the current file name without ext.

    Default is "".

  • pasteImage.insertPattern

    The pattern of string that would be pasted to text.

    You can configure both the alt text and the file path. For example, ![${imageFileNameWithoutExt}](${imageFilePath}) would add the file name as the alt text instead of the default (blank).

    You can use the following variables:

    • ${imageFilePath}: the image file path, with pasteImage.prefix, pasteImage.suffix, and url encoded.
    • ${imageOriginalFilePath}: the image file path.
    • ${imageFileName}: the image file name with ext.
    • ${imageFileNameWithoutExt}: the image file name without ext.
    • ${currentFileDir}: the path of directory that contain current editing file.
    • ${projectRoot}: the path of the project opened in vscode.
    • ${currentFileName}: the current file name with ext.
    • ${currentFileNameWithoutExt}: the current file name without ext.
    • ${imageSyntaxPrefix}: in markdown file it would be ![](, in asciidoc file it would be image::, in other file it would be empty string
    • ${imageSyntaxSuffix}: in markdown file it would be ), in asciidoc file it would be [], in other file it would be empty string

    Default is ${imageSyntaxPrefix}${imageFilePath}${imageSyntaxSuffix}.

  • pasteImage.showFilePathConfirmInputBox

    Enabling this boolean setting will make Paste Image ask you to confirm the file path(or file name). This is useful if you want to change the file path of the image you are currently pasting. Default is false.

  • pasteImage.filePathConfirmInputBoxMode

    • fullPath: show full path in inputBox, so you can change the path or name. Default value.
    • onlyName: show only file name in inputBox, so it's easy to change name.

Config Example

I use vscode to edit my hexo blog. The folder struct like this:

blog/source/_posts  (articles)
blog/source/img     (images)

I want to save all image in blog/source/img, and insert image url to article. And hexo will generate blog/source/ as the website root, so the image url should be like /img/xxx.png. So I can config pasteImage in blog/.vscode/setting.json like this:

"pasteImage.path": "${projectRoot}/source/img",
"pasteImage.basePath": "${projectRoot}/source",
"pasteImage.forceUnixStyleSeparator": true,
"pasteImage.prefix": "/"

If you want to save image in separate directory:

"pasteImage.path": "${projectRoot}/source/img/${currentFileNameWithoutExt}",
"pasteImage.basePath": "${projectRoot}/source",
"pasteImage.forceUnixStyleSeparator": true,
"pasteImage.prefix": "/"

If you want to save image with article name as prefix:

"pasteImage.namePrefix": "${currentFileNameWithoutExt}_",
"pasteImage.path": "${projectRoot}/source/img",
"pasteImage.basePath": "${projectRoot}/source",
"pasteImage.forceUnixStyleSeparator": true,
"pasteImage.prefix": "/"

If you want to use html in markdown:

"pasteImage.insertPattern": "<img>${imageFileName}</img>"
"pasteImage.path": "${projectRoot}/source/img",
"pasteImage.basePath": "${projectRoot}/source",
"pasteImage.forceUnixStyleSeparator": true,
"pasteImage.prefix": "/"

Format

File name format

If you selected some text in editor, then extension will use it as the image file name. The selected text can be a sub path like subFolder/subFolder2/nameYouWant.

If not the image will be saved in this format: "Y-MM-DD-HH-mm-ss.png". You can config default image file name by pasteImage.defaultName.

File link format

When you editing a markdown, it will pasted as markdown image link format ![](imagePath).

When you editing a asciidoc, it will pasted as asciidoc image link format image::imagePath[].

In other file, it just paste the image's path.

Now you can use configuration pasteImage.insertPattern to config the format of file link and the alt text.

Contact

If you have some any question or advice, Welcome to issue

TODO

  • [x] support win (by @kivle)
  • [x] support linux
  • [x] support use the selected text as the image name
  • [x] support config (@ysknkd in #4)
  • [x] support config relative/absolute path (@ysknkd in #4)
  • [x] support asciidoc
  • [x] support use variable ${projectRoot} and ${currentFileDir} in config
  • [x] support config basePath
  • [x] support config forceUnixStyleSeparator
  • [x] support config prefix
  • [x] support config suffix
  • [x] support use variable ${currentFileName} and ${currentFileNameWithoutExt} in config
  • [x] support check if the dest directory is a file
  • [x] support select text as a sub path with multi new directory like a/b/c/d/imageName or ../a/b/c/d/imageName
  • [x] support config default image name pattern
  • [x] support config the text format
  • [x] support file path confirm box (by @DonMartin76)

License

The extension and source are licensed under the MIT license.

Donate

If you like this plugin, you can donate to me to support me develop it better, thank you!

PayPal:

支付宝:

alipay

微信支付:

weixin

Donator list:

  • 白色咖啡
  • Paul Egbert
  • CallOnISS
  • 亮亮
  • Shahid Iqbal
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].