joplin-plugin-copy-as-html 1.1.0 → 1.1.2

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
@@ -13,56 +13,91 @@ The primary use case is copying text from Joplin and pasting formatted text into
13
13
 
14
14
  This will populate the clipboard's text/html category with the HTML formatted text.
15
15
 
16
- > [!note]
17
- > By design, the plugin only copies an HTML fragment including the basic semantic HTML markup (i.e. it won't include any of the Joplin theme styling). This is for maximum compatibility with pasting into other apps, so you don't see issues such as Joplin's background color being pasted- you'll just get the formatted text (bold, italics, formatted lists, etc...).
18
-
19
16
  ### Embed images as base64
20
17
 
21
18
  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.
22
19
 
23
20
  This should work with both markdown image embeds and the html `<img>` embeds that you get when resizing images via joplin's rich text editor.
24
21
 
22
+ ### Export as fragment or full HTML document
23
+
24
+ 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).
25
+
26
+ #### HTML Fragment
27
+
28
+ By default, the plugin will populate the clipboard with an HTML fragment, e.g:
29
+
30
+ ```html
31
+ <html>
32
+ <body>
33
+ <!--StartFragment-->
34
+ <h2>Test Heading</h2>
35
+ <p>Test paragraph 1</p>
36
+ <p>Test paragraph 2</p>
37
+ <!--EndFragment-->
38
+ </body>
39
+ </html>
40
+ ```
41
+
42
+ 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.
43
+
44
+ #### Full HTML Document
45
+
46
+ Optionally, you can enable the setting "Export as full HTML document".
47
+
48
+ 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.
49
+
50
+ 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.
51
+
25
52
  ### Optional markdown syntax
26
53
 
27
54
  The plugin will adhere to Joplin's settings for whether or not to render:
28
55
 
29
56
  - Soft Breaks
30
- - `^sup^`
31
- - `~sub~`
32
- - `==mark==`
57
+ - Typographer
58
+ - Linkify
59
+ - ==mark==
60
+ - Footnotes
61
+ - Table of Contents
62
+ - ~sub~
63
+ - ^sup^
64
+ - Deflist
65
+ - Abbreviation
66
+ - Markdown Emoji
67
+ - ++Insert++
68
+ - Multimarkdown Table
33
69
 
34
70
  ## Copy as Plain Text
35
71
 
36
72
  "Copy selection as Plain Text" is provided as a right click context menu option and as a keyboard shortcut (ctrl + alt + c by default).
37
73
 
38
- This will strip markdown formatting characters, backslash escapes, and image embeds (e.g. `![](:/22cce3a8c2244493877c66c9e3259274)` or `<img src=":/5bb1066cec6f4c849cefc28ba7b0fc1e">`) from the source markdown and populate it as text/plain in the clipboard, for scenarios where you need to paste into an app that supports neither HTML formatting or markdown.
74
+ This will strip markdown formatting characters, backslash escapes, and image embeds from the source markdown and populate it as text/plain in the clipboard, for scenarios where you need to paste into an app that supports neither HTML formatting or markdown.
39
75
 
40
76
  List leaders and nested list indentation will be maintained (these are normally lost when copying from the markdown viewer or rich text editor).
41
77
 
78
+ ### Customizing plain text output
79
+
42
80
  The following options are provided to preserve specific markdown formatting in the text/plain output:
43
81
 
44
82
  - Preserve superscript characters `(^TEST^)`
45
- If enabled, `^TEST^` will remain `^TEST^` in plain text output.
46
83
 
47
84
  - Preserve subscript characters `(~TEST~)`
48
- If enabled, `~TEST~` will remain `~TEST~` in plain text output.
49
85
 
50
86
  - Preserve emphasis characters `(*TEST* or _TEST_)`
51
- If enabled, `*TEST*` or `_TEST_` will remain as-is in plain text output.
52
87
 
53
88
  - Preserve bold characters `(**TEST** or __TEST__)`
54
- If enabled, `**TEST*`* or `__TEST__` will remain as-is in plain text output.
55
89
 
56
90
  - Preserve heading characters `(## TEST)`
57
- If enabled, `## TEST` will remain as-is in plain text output.
91
+
92
+ - Preserve strikethrough characters (`~~TEST~~`)
93
+
94
+ - Preserve horizontal rule (`---`)
58
95
 
59
96
  - Preserve highlight characters `(==TEST==)`
60
- If enabled, `==TEST==` will remain as-is in plain text output.
61
97
 
62
98
  - Preserve insert characters `(++TEST++)`
63
- If enabled, `++TEST++` will remain as-is in plain text output.
64
99
 
65
- As of version 1.0.15, the following options are provided for external hyperlinks (only impacts markdown links containing http/https URL):
100
+ The following options are provided for external hyperlinks (only impacts markdown links containing http/https URL):
66
101
 
67
102
  - Title - Displays link title only (default).
68
103
 
@@ -70,9 +105,19 @@ As of version 1.0.15, the following options are provided for external hyperlinks
70
105
 
71
106
  - Markdown Format - Displays full markdown link formatting with title and URL.
72
107
 
108
+ The following options are provided for indentation style:
109
+
110
+ - Tabs
111
+ - (4) Spaces (default)
112
+
113
+ ### Markdown emoji
114
+
115
+ Copy as Plain Text supports the markdown-it emoji plugin, so emoji such as :white_check_mark: will be displayed in the plain text output. This can be disabled if desired via the Display emojis setting.
116
+
73
117
  ## Known Issues
74
118
 
75
119
  - The context menu options appear in the rich text editor's context menu (but aren't functional, the plugin is only intended for the markdown editor).
120
+ - The plugin's keyboard shortcuts sometimes don't work on cold start of Joplin, can be fixed by toggling editors or going to Tools | Options | Keyboard Shortcuts and back.
76
121
 
77
122
  ## Misc
78
123
 
package/package.json CHANGED
@@ -1,48 +1,57 @@
1
1
  {
2
- "name": "joplin-plugin-copy-as-html",
3
- "version": "1.1.0",
4
- "scripts": {
5
- "dist": "webpack --env joplin-plugin-config=buildMain && webpack --env joplin-plugin-config=buildExtraScripts && webpack --env joplin-plugin-config=createArchive",
6
- "prepare": "npm run dist",
7
- "updateVersion": "webpack --env joplin-plugin-config=updateVersion",
8
- "update": "npm install -g generator-joplin && yo joplin --node-package-manager npm --update --force"
9
- },
10
- "license": "MIT",
11
- "keywords": [
12
- "joplin-plugin"
13
- ],
14
- "files": [
15
- "publish"
16
- ],
17
- "devDependencies": {
18
- "@types/jsdom": "^21.1.7",
19
- "@types/markdown-it": "^14.1.2",
20
- "@types/node": "^18.7.13",
21
- "chalk": "^4.1.0",
22
- "copy-webpack-plugin": "^11.0.0",
23
- "fs-extra": "^10.1.0",
24
- "glob": "^8.0.3",
25
- "tar": "^6.1.11",
26
- "ts-loader": "^9.3.1",
27
- "typescript": "^4.8.2",
28
- "webpack": "^5.74.0",
29
- "webpack-cli": "^4.10.0"
30
- },
31
- "dependencies": {
32
- "@joplin/renderer": "^3.3.1",
33
- "jsdom": "^26.1.0",
34
- "markdown-it": "^14.1.0",
35
- "markdown-it-abbr": "^2.0.0",
36
- "markdown-it-deflist": "^3.0.0",
37
- "markdown-it-emoji": "^3.0.0",
38
- "markdown-it-footnote": "^4.0.0",
39
- "markdown-it-ins": "^4.0.0",
40
- "markdown-it-mark": "^4.0.0",
41
- "markdown-it-multimd-table": "^4.2.3",
42
- "markdown-it-sub": "^2.0.0",
43
- "markdown-it-sup": "^2.0.0",
44
- "markdown-it-task-lists": "^2.1.1",
45
- "markdown-it-toc-done-right": "^4.2.0",
46
- "string-width": "^7.2.0"
47
- }
2
+ "name": "joplin-plugin-copy-as-html",
3
+ "version": "1.1.2",
4
+ "scripts": {
5
+ "dist": "webpack --env joplin-plugin-config=buildMain && webpack --env joplin-plugin-config=buildExtraScripts && webpack --env joplin-plugin-config=createArchive",
6
+ "prepare": "npm run dist",
7
+ "updateVersion": "webpack --env joplin-plugin-config=updateVersion",
8
+ "update": "npm install -g generator-joplin && yo joplin --node-package-manager npm --update --force",
9
+ "lint": "eslint --ext .ts src/",
10
+ "lint:fix": "eslint --ext .ts src/ --fix",
11
+ "format": "prettier --write \"src/**/*.ts\""
12
+ },
13
+ "license": "MIT",
14
+ "keywords": [
15
+ "joplin-plugin"
16
+ ],
17
+ "files": [
18
+ "publish"
19
+ ],
20
+ "devDependencies": {
21
+ "@types/jsdom": "^21.1.7",
22
+ "@types/markdown-it": "^14.1.2",
23
+ "@types/node": "^18.7.13",
24
+ "@typescript-eslint/eslint-plugin": "^8.40.0",
25
+ "@typescript-eslint/parser": "^8.40.0",
26
+ "chalk": "^4.1.0",
27
+ "copy-webpack-plugin": "^11.0.0",
28
+ "eslint": "^9.33.0",
29
+ "eslint-config-prettier": "^10.1.8",
30
+ "eslint-plugin-prettier": "^5.5.4",
31
+ "fs-extra": "^10.1.0",
32
+ "glob": "^8.0.3",
33
+ "prettier": "^3.6.2",
34
+ "tar": "^6.1.11",
35
+ "ts-loader": "^9.3.1",
36
+ "typescript": "^4.8.2",
37
+ "webpack": "^5.74.0",
38
+ "webpack-cli": "^4.10.0"
39
+ },
40
+ "dependencies": {
41
+ "@joplin/renderer": "^3.3.1",
42
+ "jsdom": "^26.1.0",
43
+ "markdown-it": "^14.1.0",
44
+ "markdown-it-abbr": "^2.0.0",
45
+ "markdown-it-deflist": "^3.0.0",
46
+ "markdown-it-emoji": "^3.0.0",
47
+ "markdown-it-footnote": "^4.0.0",
48
+ "markdown-it-ins": "^4.0.0",
49
+ "markdown-it-mark": "^4.0.0",
50
+ "markdown-it-multimd-table": "^4.2.3",
51
+ "markdown-it-sub": "^2.0.0",
52
+ "markdown-it-sup": "^2.0.0",
53
+ "markdown-it-task-lists": "^2.1.1",
54
+ "markdown-it-toc-done-right": "^4.2.0",
55
+ "string-width": "^7.2.0"
56
+ }
48
57
  }
Binary file
@@ -2,7 +2,7 @@
2
2
  "manifest_version": 1,
3
3
  "id": "com.bwat47.copyashtml",
4
4
  "app_min_version": "3.3",
5
- "version": "1.1.0",
5
+ "version": "1.1.2",
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",
@@ -130,8 +130,18 @@
130
130
  "markdown": "Markdown Format"
131
131
  },
132
132
  "value": "title"
133
+ },
134
+ "indentType": {
135
+ "type": "enum",
136
+ "label": "List indentation type",
137
+ "description": "How nested lists should be indented in plain text output.",
138
+ "options": {
139
+ "spaces": "4 Spaces",
140
+ "tabs": "Tabs"
141
+ },
142
+ "value": "spaces"
133
143
  }
134
144
  },
135
- "_publish_hash": "sha256:0332aa07456ed137d6f166da4c2e00a4e06c9f3750e5910034bac5ea81763bea",
136
- "_publish_commit": "main:3869b85f0653e4622b9a53e0da3d3231e682dd7c"
145
+ "_publish_hash": "sha256:3c4f58b50314b1847100bcef0e37f4c7a9ef157c6ccb26e1757b393d8ca93aa9",
146
+ "_publish_commit": "main:1242c9604f667a30565e139ae7f2c0ea4dcbb41d"
137
147
  }