Skip to content

Commit

Permalink
added a new predefined variable ${uuid} which generates a random uuid v4
Browse files Browse the repository at this point in the history
  • Loading branch information
rtfmkiesel committed Jan 16, 2025
1 parent 792c81c commit b2f6152
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Smartly paste for Markdown.
- `${fileDirname}` - the current opened file's directory name
- `${datetime}` - the current date & time formatted by `"yyyyMMDDHHmmss"`, You can customize the format by format string. exp: `${datetime|yyyy-MM-DD_HH-mm-ss}`
- `${selectedText}` - the current selected text. If selected text contain illegal characters `\/:*?""<>|\r\n` it will return "". You can also set the default text, exp: `${selectedText|default text}`, If selected text contain illegal characters or selected text is empty it will return the default text.
- `${uuid}` - a random UUID v4

- `MarkdownPaste.path`

Expand Down
22 changes: 18 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@
"openai": "^4.61.0",
"shelljs": "^0.8.5",
"turndown": "^7.1.2",
"uuid": "^11.0.5",
"xclip": "^1.0.7"
},
"devDependencies": {
Expand Down
8 changes: 8 additions & 0 deletions src/predefine.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as vscode from "vscode";
import moment from "moment";
import * as path from "path";
import { v4 as uuidv4 } from "uuid";

class Predefine {
_workspaceRoot: string;
Expand Down Expand Up @@ -93,6 +94,13 @@ class Predefine {
return this.filePath();
}

/**
* a random UUID v4
*/
public uuid(): string {
return uuidv4();
}

/**
* Get current selected text.
* @param defaultText
Expand Down

0 comments on commit b2f6152

Please sign in to comment.