joplin-plugin-copy-as-html 1.6.6 → 1.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,142 +1,91 @@
1
1
  # Joplin Copy as HTML
2
2
 
3
- > [!note]
4
- > This plugin was created entirely with AI tools.
5
-
6
- This plugin allows you to copy selected text in the markdown editor as either HTML or structured plain text.
7
-
8
- The primary use case is copying text from Joplin and pasting formatted text into other apps that support HTML formatting (e.g. pasting text into an Outlook email). A plain text fallback is provided for scenarios where you need to paste text into an application that supports neither HTML formatting nor markdown.
9
-
10
- ![copy-as-html-gif](https://github.com/user-attachments/assets/a46ef4fe-b54a-485d-81ca-62700fecf022)
3
+ Copy selected Markdown from Joplin as formatted HTML or readable plain text. Paste into apps such as Outlook and Gmail, with optional image embedding and customizable plain text output.
11
4
 
12
- ## Copy as HTML
5
+ ![Copying selected Markdown from Joplin and pasting it as formatted text](https://github.com/user-attachments/assets/a46ef4fe-b54a-485d-81ca-62700fecf022)
13
6
 
14
- "Copy selection as HTML" is provided as a right click context menu option and as a keyboard shortcut (ctrl + shift + c by default).
7
+ ## Usage
15
8
 
16
- This will populate the clipboard's text/html category with the HTML formatted text.
9
+ 1. Select text in Joplin's **Markdown editor**.
10
+ 2. Right-click the selection or open the **Edit** menu and choose one of the commands below.
11
+ 3. Paste into the destination app.
17
12
 
18
- > [!NOTE]
19
- > In Joplin 3.5.4 and newer, it will populate both text/html and text/plain (allowing you to paste either formatted or plain text).
20
-
21
- ### Embed images as base64
13
+ | Command | Default shortcut |
14
+ | ---------------------------- | ---------------- |
15
+ | Copy selection as HTML | `Ctrl+Shift+C` |
16
+ | Copy selection as Plain Text | `Ctrl+Alt+C` |
22
17
 
23
- By default, the plugin will embed any images as base64 in the text/html output, allowing you paste text + images into external applications. However, this can be disabled in the plugin's settings.
18
+ **Copy selection as HTML** puts both formatted HTML and a plain text fallback on the clipboard. The destination app determines which format to use. **Copy selection as Plain Text** copies only plain text.
24
19
 
25
- This will work with both markdown image embeds and the html `<img>` embeds that you get when resizing images via joplin's rich text editor.
20
+ The [plain text options](#plain-text-options) apply to both the plain text command and the HTML command's fallback.
26
21
 
27
- ### Download and embed remote images as base64
22
+ Configure the plugin in Joplin's settings under **Copy as HTML**.
28
23
 
29
- If you enable this option (along with "Embed images as base64"), remote image embeds will be downloaded and embedded as base64 (making the images viewable without internet access).
24
+ ## HTML options
30
25
 
31
- ### Export as fragment or full HTML document
26
+ ### Images and drawings
32
27
 
33
- When you copy text from Joplin's markdown viewer (or export the note to HTML), there is a lot of styling applied which can sometimes cause issues pasting text into other editors (e.g. if you copy from the markdown viewer, your joplin theme's background color may be pasted).
28
+ Local Joplin images are embedded as base64 by default, allowing you to paste text and images together. Both Markdown images and HTML `<img>` tags are supported.
34
29
 
35
- #### HTML Fragment
30
+ | Setting | Default | Behavior |
31
+ | -------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
32
+ | Embed images as base64 | On | Embeds local Joplin images in the HTML. Turning this off removes local Joplin images from the output. |
33
+ | Download and embed remote images | Off | Downloads and embeds remote HTTP/HTTPS images when image embedding is enabled. Otherwise, remote images remain linked to their original URLs. |
34
+ | Convert SVG images to PNG | On | Converts embedded SVG images to PNG for compatibility with editors and email clients. |
36
35
 
37
- By default, the plugin will populate the clipboard with an HTML fragment, e.g:
36
+ Successfully embedded remote images can be viewed without internet access. If a download fails, the original image URL is retained.
38
37
 
39
- ```html
40
- <html>
41
- <body>
42
- <!--StartFragment-->
43
- <h2>Test Heading</h2>
44
- <p>Test paragraph 1</p>
45
- <p>Test paragraph 2</p>
46
- <!--EndFragment-->
47
- </body>
48
- </html>
49
- ```
38
+ Drawings from Freehand Drawing, Excalidraw, and Drawio are supported when stored as Joplin image resources (embedded like any other image resource).
50
39
 
51
- This is similar to what you get when copying from Joplin's TinyMCE rich text editor (semantic markup, no css styling). Any styling will be determined by the application you're pasting the text into.
40
+ ### HTML fragment or full document
52
41
 
53
- #### Full HTML Document
42
+ - **Default:** Copies an HTML fragment without an added stylesheet. The destination app determines its appearance.
43
+ - **Export as full HTML document:** Wraps the content in a full HTML document with the [bundled stylesheet](src/defaultStylesheet.ts) or your custom CSS.
54
44
 
55
- Optionally, you can enable the setting "Export as full HTML document".
45
+ To use custom CSS, create `copy-as-html-user.css` in your Joplin profile directory. Open **Help > Open profile directory** to locate it. The custom stylesheet replaces the bundled stylesheet and is used only when **Export as full HTML document** is enabled.
56
46
 
57
- This will wrap the HTML fragment in a full HTML document with CSS styling. A default (minimal) css [stylesheet](https://github.com/bwat47/joplin-copy-as-html/blob/main/src/defaultStylesheet.ts) is provided. The default stylesheet is only used if no custom stylesheet is provided and the "Export as full HTML document" setting is enabled.
47
+ ### Markdown rendering
58
48
 
59
- To use your own stylesheet, create a file called `copy-as-html-user.css` in your Joplin profile directory. To locate your Joplin profile directory, open Joplin and click Help | Open profile directory.
49
+ HTML output follows Joplin's Markdown rendering settings, including options such as footnotes, highlighting, and tables.
60
50
 
61
- ### Optional markdown syntax
62
-
63
- The plugin will adhere to Joplin's settings for whether or not to render:
51
+ <details>
52
+ <summary>Supported optional Markdown settings</summary>
64
53
 
65
54
  - Soft Breaks
66
55
  - Typographer
67
56
  - Linkify
68
- - ==mark==
57
+ - Highlight (`==mark==`)
69
58
  - Footnotes
70
59
  - Table of Contents
71
- - ~sub~
72
- - ^sup^
60
+ - Subscript (`~sub~`)
61
+ - Superscript (`^sup^`)
73
62
  - Deflist
74
63
  - Abbreviation
75
64
  - Markdown Emoji
76
- - ++Insert++
65
+ - Insert (`++Insert++`)
77
66
  - Multimarkdown Table
78
67
 
79
- > [!note]
80
- > Mermaid/Math are not supported, they will render as plain text.
81
-
82
- ### Freehand Drawing/Excalidraw/Drawio
83
-
84
- These plugins embed the drawings as joplin image resources (svg), and the plugin will embed them as base64 as it does other images.
85
-
86
- SVG images may have compatibility issues with certain editors/email clients, so by default the plugin will convert svg images to png when embedding images, however this can be disabled in the plugin settings.
87
-
88
- ## Copy as Plain Text
89
-
90
- "Copy selection as Plain Text" is provided as a right click context menu option and as a keyboard shortcut (ctrl + alt + c by default).
91
-
92
- This command parses the selected Markdown and renders it as normalized paste-friendly plain text. By default it removes all markdown formatting markers and image embeds, while preserving document structure such as paragraphs, list leaders, nested list indentation, tables (optimized for plain text readability), footnotes, and link text. However, the plain text output can be customized to retain specific markdown formatting (see below).
93
-
94
- ### Customizing plain text output
95
-
96
- The following options are provided to preserve specific markdown formatting markers in the `text/plain` output when desired:
97
-
98
- - Preserve superscript markers
68
+ </details>
99
69
 
100
- - Preserve subscript markers
70
+ ## Plain text options
101
71
 
102
- - Preserve emphasis markers
72
+ Plain text output removes Markdown formatting markers and images while preserving paragraphs, list markers, nested list indentation, readable tables, footnotes, and link text. It parses Markdown independently of Joplin's HTML rendering settings.
103
73
 
104
- - Preserve bold markers
74
+ | Setting | Default | Options |
75
+ | ----------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------- |
76
+ | Plain text hyperlink behavior | Link Title | Keep link text, show the URL, or preserve Markdown link formatting. Applies to Markdown links with HTTP/HTTPS URLs. |
77
+ | List indentation type | 4 Spaces | Indent nested lists with four spaces or tabs. |
78
+ | List spacing | Loose | Loose adds blank lines between list items; Tight omits them. |
79
+ | Display emojis | On | Converts emoji shortcodes such as `:white_check_mark:` to Unicode (✅). |
80
+ | Preserve table pipes | Off | Retains Markdown pipe separators in tables. |
105
81
 
106
- - Preserve heading markers
82
+ You can also preserve superscript, subscript, emphasis, bold, heading, quote, strikethrough, highlight, and insert markers, horizontal rules, and code backticks. These options are off by default and appear when you enable **Show advanced settings** in the plugin's settings section.
107
83
 
108
- - Preserve quote markers
84
+ ## Limitations
109
85
 
110
- - Preserve strikethrough markers
86
+ - Commands work on selected text in the Markdown editor. They do not work in the rich text editor or Markdown viewer.
87
+ - Mermaid diagrams and math are not rendered; they are copied as plain text.
88
+ - HTML styling and embedded image support depend on the destination app.
111
89
 
112
- - Preserve horizontal rules
113
-
114
- - Preserve highlight markers
115
-
116
- - Preserve insert markers
117
-
118
- - Preserve code backticks
119
-
120
- - Preserve table pipes
121
-
122
- The following options are provided for external hyperlinks (only affects markdown links with `http`/`https` URLs):
123
-
124
- - Title - Displays link title only (default).
125
-
126
- - URL - Displays link URL only.
127
-
128
- - Markdown Format - Displays full markdown link formatting with title and URL.
129
-
130
- The following options are provided for indentation style:
131
-
132
- - Tabs
133
- - (4) Spaces (default)
134
-
135
- The following options are provided for list spacing:
136
-
137
- - Tight - No blank lines between list items.
138
- - Loose - Adds blank lines between list items (default).
139
-
140
- ### Markdown emoji
141
-
142
- Copy as Plain Text supports markdown emoji shortcodes, so emoji such as :white_check_mark: can be rendered as Unicode in the plain text output. This can be disabled via the Display emojis setting.
90
+ > [!NOTE]
91
+ > This plugin was created entirely with AI tools.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joplin-plugin-copy-as-html",
3
- "version": "1.6.6",
3
+ "version": "1.6.7",
4
4
  "scripts": {
5
5
  "dist": "webpack --env joplin-plugin-config=buildMain && webpack --env joplin-plugin-config=buildExtraScripts && webpack --env joplin-plugin-config=createArchive",
6
6
  "prepare": "npm run dist",
@@ -21,26 +21,25 @@
21
21
  ],
22
22
  "devDependencies": {
23
23
  "@eslint/js": "^10.0.1",
24
- "@types/jsdom": "^28.0.3",
24
+ "@types/jsdom": "^30.0.0",
25
25
  "@types/mdast": "^4.0.4",
26
26
  "@types/node": "^25.9.4",
27
- "@typescript-eslint/eslint-plugin": "^8.59.2",
28
- "@typescript-eslint/parser": "^8.59.2",
27
+ "@vitest/eslint-plugin": "^1.6.27",
29
28
  "chalk": "^4.1.0",
30
29
  "copy-webpack-plugin": "^14.0.0",
31
- "eslint": "^10.3.0",
30
+ "eslint": "^10.12.0",
32
31
  "eslint-config-prettier": "^10.1.8",
33
- "eslint-plugin-import-x": "^4.16.2",
34
- "eslint-plugin-sonarjs": "^4.2.0",
32
+ "eslint-plugin-sonarjs": "^4.2.2",
35
33
  "fs-extra": "^11.3.2",
36
34
  "glob": "^8.0.3",
37
35
  "globals": "^14.0.0",
38
- "jsdom": "^29.1.1",
39
- "knip": "^6.24.0",
40
- "prettier": "^3.8.3",
36
+ "jsdom": "^30.1.2",
37
+ "knip": "^6.40.0",
38
+ "prettier": "^3.9.9 ",
41
39
  "tar": "^7.5.7",
42
40
  "ts-loader": "^9.5.7",
43
41
  "typescript": "^6.0.3",
42
+ "typescript-eslint": "^8.71.1",
44
43
  "vitest": "^5.0.0",
45
44
  "webpack": "^5.103.0",
46
45
  "webpack-cli": "^6.0.1"
@@ -54,7 +53,7 @@
54
53
  "remark-ins": "^1.2.4",
55
54
  "remark-parse": "^11.0.0",
56
55
  "remark-supersub": "^1.0.0",
57
- "string-width": "^8.1.0",
56
+ "string-width": "^8.3.0",
58
57
  "unified": "^11.0.5"
59
58
  }
60
59
  }
Binary file
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "manifest_version": 1,
3
3
  "id": "com.bwat47.copyashtml",
4
- "app_min_version": "3.3",
5
- "version": "1.6.6",
4
+ "app_min_version": "3.5.11",
5
+ "version": "1.6.7",
6
6
  "name": "Copy as HTML",
7
7
  "description": "Allows you to copy text with HTML (rich text) formatting from the markdown editor (including images). Also allows you to copy as plain text (without markdown formatting)",
8
8
  "author": "bwat47",
@@ -48,141 +48,6 @@
48
48
  "src": "images/copyashtml_promo_tile.png",
49
49
  "label": "Copy as HTML Promo Tile"
50
50
  },
51
- "settings": {
52
- "embedImages": {
53
- "type": "bool",
54
- "label": "Embed images as base64",
55
- "description": "If enabled, images in selection will be embedded as base64 in HTML output.",
56
- "value": true
57
- },
58
- "exportFullHtml": {
59
- "type": "bool",
60
- "label": "Export as full HTML document",
61
- "description": "If enabled, exported HTML will be a full document with your custom stylesheet (copy-as-html-user.css in your profile folder).",
62
- "value": false
63
- },
64
- "downloadRemoteImages": {
65
- "type": "bool",
66
- "label": "Download and embed remote images",
67
- "description": "If enabled (along with Embed images as base64), remote HTTP/HTTPS images will be downloaded and embedded as base64. If un-checked, the resulting document may contain links to external resources.",
68
- "value": false
69
- },
70
- "embedSvgAsPng": {
71
- "type": "bool",
72
- "label": "Convert SVG images to PNG",
73
- "description": "If enabled, embedded SVG images will be rasterized as PNG to improve compatibility with applications that cannot display inline SVG.",
74
- "value": true
75
- },
76
- "preserveSuperscript": {
77
- "type": "bool",
78
- "label": "Preserve superscript markers",
79
- "description": "If enabled, superscript markers will be preserved in plain text output.",
80
- "value": false
81
- },
82
- "preserveSubscript": {
83
- "type": "bool",
84
- "label": "Preserve subscript markers",
85
- "description": "If enabled, subscript markers will be preserved in plain text output.",
86
- "value": false
87
- },
88
- "preserveEmphasis": {
89
- "type": "bool",
90
- "label": "Preserve emphasis markers",
91
- "description": "If enabled, emphasis markers will be preserved in plain text output.",
92
- "value": false
93
- },
94
- "preserveBold": {
95
- "type": "bool",
96
- "label": "Preserve bold markers",
97
- "description": "If enabled, bold markers will be preserved in plain text output.",
98
- "value": false
99
- },
100
- "preserveHeading": {
101
- "type": "bool",
102
- "label": "Preserve heading markers",
103
- "description": "If enabled, heading markers will be preserved in plain text output.",
104
- "value": false
105
- },
106
- "preserveQuoteMarkers": {
107
- "type": "bool",
108
- "label": "Preserve quote markers",
109
- "description": "If enabled, blockquote markers will be preserved in plain text output.",
110
- "value": false
111
- },
112
- "preserveStrikethrough": {
113
- "type": "bool",
114
- "label": "Preserve strikethrough markers",
115
- "description": "If enabled, strikethrough markers will be preserved in plain text output.",
116
- "value": false
117
- },
118
- "preserveHorizontalRule": {
119
- "type": "bool",
120
- "label": "Preserve horizontal rules",
121
- "description": "If enabled, horizontal rules will be preserved in plain text output.",
122
- "value": false
123
- },
124
- "preserveMark": {
125
- "type": "bool",
126
- "label": "Preserve highlight markers",
127
- "description": "If enabled, highlight markers will be preserved in plain text output.",
128
- "value": false
129
- },
130
- "preserveInsert": {
131
- "type": "bool",
132
- "label": "Preserve insert markers",
133
- "description": "If enabled, insert markers will be preserved in plain text output.",
134
- "value": false
135
- },
136
- "preserveCodeBackticks": {
137
- "type": "bool",
138
- "label": "Preserve code backticks",
139
- "description": "If enabled, inline code and code block backticks will be preserved in plain text output.",
140
- "value": false
141
- },
142
- "hyperlinkBehavior": {
143
- "type": "enum",
144
- "label": "Plain text hyperlink behavior",
145
- "description": "How external HTTP/HTTPS links should appear in plain text output.",
146
- "options": {
147
- "title": "Link Title",
148
- "url": "Link URL",
149
- "markdown": "Markdown Format"
150
- },
151
- "value": "title"
152
- },
153
- "indentType": {
154
- "type": "enum",
155
- "label": "List indentation type",
156
- "description": "How nested lists should be indented in plain text output.",
157
- "options": {
158
- "spaces": "4 Spaces",
159
- "tabs": "Tabs"
160
- },
161
- "value": "spaces"
162
- },
163
- "listSpacing": {
164
- "type": "enum",
165
- "label": "List spacing",
166
- "description": "Whether plain text lists should include blank lines between list items.",
167
- "options": {
168
- "tight": "Tight",
169
- "loose": "Loose"
170
- },
171
- "value": "loose"
172
- },
173
- "displayEmojis": {
174
- "type": "bool",
175
- "label": "Display emojis",
176
- "description": "If enabled, emojis will be displayed in the plain text output.",
177
- "value": true
178
- },
179
- "preserveTablePipes": {
180
- "type": "bool",
181
- "label": "Preserve table pipes",
182
- "description": "If enabled, markdown pipe separators will be preserved in plain text output.",
183
- "value": false
184
- }
185
- },
186
- "_publish_hash": "sha256:baab5ce025137cc5d807d178d6e7b05268bad849ab4677303132870ce1859d45",
187
- "_publish_commit": "main:76fe5327e1f07769b06a79512868b5c53ca9b513"
51
+ "_publish_hash": "sha256:ae49993ffb10462eaf9343af39b313c15c3c73db49ba1826a6b1beaab84b2c6b",
52
+ "_publish_commit": "main:a02aa0c010289b4863fb344282691ff3388b49d3"
188
53
  }