Skip to content

Commit

Permalink
fix: add docs and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisTowles committed Sep 29, 2022
1 parent d166ed9 commit 5ef5bd1
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 17 deletions.
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,35 @@
-->
</p>

<p align="center">
Paste Image from clipboard into markdown for VS Code.<br>
</p>

<img src="https://raw.githubusercontent.com/ChrisTowles/vscode-markdown-paste-image/main/res/markdown-paste-image-preview.gif" height="150">

## Requirements

- `xclip` command be required (Linux)
- `powershell` command be required (Win32)
- `pbpaste` command be required (Mac)

<p align="center">
Smart selection with double clicks for VS Code.<br>

</p>
`// TODO GIF`

## Usage

`// TODO`

## Rules

<!-- Generated from JSDocs, do not modify it directly -->
<!--rules-->
<!--rules-->

## Configuration

All the rules are enabled by default. To disable a specific rule, set the rule to `false` in `smartClicks.rules` of your VS Code settings:

Time format is configured with [Luxon](https://moment.github.io/luxon/#/formatting?id=table-of-tokens)

```jsonc
// settings.json

```

`// TODO GIF`

## VsCode Docs

- <https://code.visualstudio.com/api/references/activation-events>
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"contributes": {
"configuration": {
"type": "object",
"title": "Paste Image Configuration",
"title": "Markdown Paste Image Configuration",
"properties": {
"markdownPasteImage.imageFolderPath": {
"type": "string",
Expand All @@ -50,7 +50,7 @@
},
"markdownPasteImage.defaultImageName": {
"type": "string",
"default": "yyyy-LL-mm-HH-mm-ss",
"default": "yyyyLLmm-HHmmss",
"description": "The default image file name. The value of this config will be pass to the 'format' function of Luxon library, you can read document https://moment.github.io/luxon/#/formatting?id=table-of-tokens for usage."
},
"markdownPasteImage.imageNamePrefix": {
Expand Down
7 changes: 6 additions & 1 deletion playground/folder-test/test.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Test Markdown

Test file without an image
Paste an Image you have in your clipboard!

It will prompt you for a file name and then save it to the folder you are in.


Also select text to use that as the image file name.
Binary file added res/markdown-paste-image-preview.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/markdown-paste-image-preview.webm
Binary file not shown.
2 changes: 1 addition & 1 deletion src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const parseConfigurationToConfig = async ({ projectRootDirPath, editorOpe
const editorOpenFolderPath = await ensureFileAndGetItsDirectory(editorOpenFilePath);

// Luxon Values used in ImageName = https://moment.github.io/luxon/#/formatting?id=table-of-tokens
let defaultImageName = configuration.get<string>(Constants.Config_DefaultImageName, 'yyyy-LL-dd-HH-mm-ss');
let defaultImageName = configuration.get<string>(Constants.Config_DefaultImageName, Constants.DefaultLuxonTimeStampFormat);

// eslint-disable-next-line no-template-curly-in-string
let imageFolderPath = configuration.get<string>(Constants.Config_ImageFolderPath, '${currentFileDir}');
Expand Down
2 changes: 2 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ export class Constants {

public static Config_ImageUriPathPrefix = 'imageUriPathPrefix';
public static Config_ImageUriPathSuffix = 'imageUriPathSuffix';

public static DefaultLuxonTimeStampFormat = 'yyyyLLmm-HHmmss';
}
2 changes: 1 addition & 1 deletion src/test/mockWorkspaceConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class MockWorkspaceConfiguration implements WorkspaceConfiguration {
result = '';
break;
case Constants.Config_DefaultImageName:
result = 'yyyy-LL-mm-HH-mm-ss';
result = Constants.DefaultLuxonTimeStampFormat;
break;
case Constants.Config_EncodePath:
result = 'urlEncodeSpace'; // todo: enum
Expand Down

0 comments on commit 5ef5bd1

Please sign in to comment.