Skip to content

Commit

Permalink
doc: format readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
telesoho committed Feb 12, 2025
1 parent 5578acc commit 4efe3ae
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 44 deletions.
62 changes: 28 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,28 +237,24 @@ Smartly paste for Markdown.
**NOTE** If any language rule been matched, it will not apply `MarkdownPaste.rules` anymore.

- `MarkdownPaste.autoSelectClipboardType`

Auto select clipboard type while multiple clipboard types are available. default is: `html&text`

- `MarkdownPaste.autoSelectClipboardTypePriority`

Auto select clipboard type priority. default is:
Auto select clipboard type priority. default is:

```json
[
"image",
"html",
"text"
]
["image", "html", "text"]
```

- `MarkdownPaste.enableAI`

Enable AI clipboard parsing feature. default is `false`.

- `MarkdownPaste.openaiConnectOption`
Set OpenAI (compatible) connection options. default is:

Set OpenAI (compatible) connection options. default is:

```json
"MarkdownPaste.openaiConnectOption": {
Expand All @@ -268,54 +264,53 @@ Smartly paste for Markdown.
}
```

The extension use Groq LLM server by default. You can got an API key from [Groq.com](https://groq.com/).
The extension use [OpenAi Node](https://github.com/openai/openai-node) to connect LLM server. So you can also use another LLM server by setting `MarkdownPaste.openaiConnectOption.baseURL`, e.g. `MarkdownPaste.openaiConnectOption.baseURL = "https://api.openai.com/v1"`, the more detail about openai connection options, please see: https://github.com/openai/openai-node
The extension use Groq LLM server by default. You can got an API key from [Groq.com](https://groq.com/).
The extension use [OpenAi Node](https://github.com/openai/openai-node) to connect LLM server. So you can also use another LLM server by setting `MarkdownPaste.openaiConnectOption.baseURL`, e.g. `MarkdownPaste.openaiConnectOption.baseURL = "https://api.openai.com/v1"`, the more detail about openai connection options, please see: https://github.com/openai/openai-node

- `MarkdownPaste.openaiCompletionTemplate`

Set OpenAI completion template. default is:

```json
[
{
"model": "llama-3.1-70b-versatile",
"messages": [
{
"role": "system",
"content": [
"You are a helpful assistant."
]
},
{
"role": "user",
"content": [
"Translate the following text into English and output in markdown format:",
"{{clipboard_text}}"
]
}
],
"max_tokens": 4096
}
{
"model": "llama-3.1-70b-versatile",
"messages": [
{
"role": "system",
"content": ["You are a helpful assistant."]
},
{
"role": "user",
"content": [
"Translate the following text into English and output in markdown format:",
"{{clipboard_text}}"
]
}
],
"max_tokens": 4096
}
]
```

Note: The extension will replace `{{clipboard_text}}` with your clipboard content.

- `MarkdownPaste.openaiCompletionTemplateFile`

Set OpenAI completion template file. default is: `${fileWorkspaceFolder}/.openaiCompletionTemplate.json`

If you want to write more complicated AI completion template, you can use this option.


- **`MarkdownPaste.imageRules`**
**(New Feature)** Define custom rules to modify the target image path and Markdown link pattern based on the current Markdown file's path. Each rule is an object with the following properties:

- `match`: A regex pattern (as a string) to test against the current Markdown file’s full path.
- `targetPath`: A string pattern (supports predefined variables) that specifies where the image should be saved.
- `linkPattern`: A string pattern (supports predefined variables) that specifies how the Markdown link for the image should be formatted. You can use `${altText}` as selected text,`${imageFilePath}` as image saved path in the setting.
- `options` (optional): Regex options (e.g., `"i"`) for the matching pattern.

**Example:**

```json
"MarkdownPaste.imageRules": [
{
Expand All @@ -331,7 +326,6 @@ Smartly paste for Markdown.
]
```


## Issues and Suggestions

1. Please submit bugs via the following link:
Expand Down
22 changes: 12 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,18 @@
}
},
"examples": [
[{
"match": "courses.*cysec",
"targetPath": "${workspaceFolder}/labs/public/images/cysec/${fileBasenameNoExtension}_${datetime|yyyy-MM-DD_HH-mm-ss}",
"linkPattern": "![${altText}](/images/cysec/${fileBasenameNoExtension}_${datetime|yyyy-MM-DD_HH-mm-ss}.png)"
},
{
"match": "courses.*wired",
"targetPath": "${workspaceFolder}/labs/public/images/wired/${fileBasenameNoExtension}_${datetime|yyyy-MM-DD_HH-mm-ss}",
"linkPattern": "<img src='/images/wired/${fileBasenameNoExtension}_${datetime|yyyy-MM-DD_HH-mm-ss}.png' alt='${altText}'/>"
}]
[
{
"match": "courses.*cysec",
"targetPath": "${workspaceFolder}/labs/public/images/cysec/${fileBasenameNoExtension}_${datetime|yyyy-MM-DD_HH-mm-ss}",
"linkPattern": "![${altText}](/images/cysec/${fileBasenameNoExtension}_${datetime|yyyy-MM-DD_HH-mm-ss}.png)"
},
{
"match": "courses.*wired",
"targetPath": "${workspaceFolder}/labs/public/images/wired/${fileBasenameNoExtension}_${datetime|yyyy-MM-DD_HH-mm-ss}",
"linkPattern": "<img src='/images/wired/${fileBasenameNoExtension}_${datetime|yyyy-MM-DD_HH-mm-ss}.png' alt='${altText}'/>"
}
]
]
},
"MarkdownPaste.rules": {
Expand Down

0 comments on commit 4efe3ae

Please sign in to comment.