joplin-plugin-html-blocks 1.0.0 → 1.0.6
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
|
@@ -10,9 +10,10 @@ Card contents, with the usual **markdown** you'd expect.
|
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
...renders as a light blue card in the note viewer, in exported HTML and in PDF
|
|
13
|
-
exports.
|
|
14
|
-
styles, steps, timelines, stat tiles,
|
|
15
|
-
|
|
13
|
+
exports. 298 block types are included, in 28 categories: cards in eleven styles,
|
|
14
|
+
admonition-style callouts, twenty-two list styles, steps, timelines, stat tiles,
|
|
15
|
+
progress bars, ratings, tables, pros and cons, FAQs, feature grids, chat
|
|
16
|
+
transcripts, grids, banners, collapsible sections and more.
|
|
16
17
|
|
|
17
18
|
## Installation
|
|
18
19
|
|
|
@@ -22,7 +23,7 @@ later on desktop.
|
|
|
22
23
|
|
|
23
24
|
## Documentation
|
|
24
25
|
|
|
25
|
-
[**User manual (PDF)**](docs/HTML-Blocks-Manual.pdf) -
|
|
26
|
+
[**User manual (PDF)**](docs/HTML-Blocks-Manual.pdf) - 89 pages covering every
|
|
26
27
|
block, with a rendered preview beside the markdown for each one. It is generated
|
|
27
28
|
by the plugin's own renderer via `npm run manual`, so the previews always match
|
|
28
29
|
what Joplin actually draws.
|
|
@@ -47,7 +48,8 @@ what Joplin actually draws.
|
|
|
47
48
|
in the corner) instead of silently vanishing.
|
|
48
49
|
|
|
49
50
|
Most blocks treat their contents as ordinary markdown. The list-like ones
|
|
50
|
-
(`list_*`, `steps`, `timeline`, `stats`, `
|
|
51
|
+
(`list_*`, `steps`, `timeline`, `stats`, `progress`, `rating`, `keyvalue`,
|
|
52
|
+
`table`, `pros_cons`, `faq_*`, `features_*`, `chat`, `badges`) treat **one line
|
|
51
53
|
as one item** instead, and split fields on `::`:
|
|
52
54
|
|
|
53
55
|
```
|
|
@@ -76,95 +78,84 @@ Right hand contents
|
|
|
76
78
|
|
|
77
79
|
Three ways, whichever suits you:
|
|
78
80
|
|
|
79
|
-
* **Toolbar button** in the editor, or **Ctrl+Alt+H** - opens
|
|
80
|
-
|
|
81
|
+
* **Toolbar button** in the editor, or **Ctrl+Alt+H** - opens the picker. If you
|
|
82
|
+
had text selected, it becomes the body of the new block.
|
|
81
83
|
* **Tools → HTML Blocks** - every block, grouped by category.
|
|
82
84
|
* **Command palette** - type "Insert block" and the block name.
|
|
83
85
|
|
|
86
|
+
The picker shows each block as a **live preview** rather than a name: every tile
|
|
87
|
+
is the real block, drawn by the same renderer the note viewer uses, so what you
|
|
88
|
+
see in the dialog is what lands in the note. It opens on the blocks you reached
|
|
89
|
+
for most recently, and the sidebar walks the categories. Typing filters across
|
|
90
|
+
every category at once - by name, id, colour, mode or theme - the arrow keys walk
|
|
91
|
+
the grid, and a double click inserts straight away.
|
|
92
|
+
|
|
93
|
+
Previews can be turned off in *Tools → Options → HTML Blocks* if you would rather
|
|
94
|
+
have a plain list of names.
|
|
95
|
+
|
|
84
96
|
**Tools → HTML Blocks → Insert cheat sheet** drops one example of every single
|
|
85
97
|
block type into the current note, which is the quickest way to see what they all
|
|
86
98
|
look like.
|
|
87
99
|
|
|
88
100
|
## Block reference
|
|
89
101
|
|
|
90
|
-
|
|
102
|
+
There are too many block types to list one by one here - the picker shows every
|
|
103
|
+
one of them as a preview, and the [user manual](docs/HTML-Blocks-Manual.pdf)
|
|
104
|
+
pairs each one with its markdown. The categories are:
|
|
91
105
|
|
|
92
|
-
|
|
|
106
|
+
| Category | Blocks | For example |
|
|
93
107
|
|---|---|---|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
-
|
|
|
98
|
-
|
|
|
99
|
-
|
|
|
100
|
-
|
|
|
101
|
-
|
|
|
102
|
-
|
|
|
103
|
-
|
|
|
104
|
-
|
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
|
112
|
-
|
|
113
|
-
|
|
|
114
|
-
|
|
|
115
|
-
|
|
|
116
|
-
|
|
|
117
|
-
|
|
|
118
|
-
|
|
|
119
|
-
|
|
|
120
|
-
|
|
|
121
|
-
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
108
|
+
| Cards | 21 | `card_light_blue`, `card_blue`, `card_indigo` |
|
|
109
|
+
| Cards · Solid | 12 | `card_solid_blue`, `card_solid_indigo`, `card_solid_violet` |
|
|
110
|
+
| Cards · Outline | 12 | `card_outline_blue`, `card_outline_indigo`, `card_outline_violet` |
|
|
111
|
+
| Cards · Gradient | 12 | `card_gradient_blue`, `card_gradient_indigo`, `card_gradient_violet` |
|
|
112
|
+
| Cards · Elevated | 12 | `card_elevated_blue`, `card_elevated_indigo`, `card_elevated_violet` |
|
|
113
|
+
| Cards · Glass | 8 | `card_glass_blue`, `card_glass_violet`, `card_glass_pink` |
|
|
114
|
+
| Cards · Neon | 8 | `card_neon_blue`, `card_neon_violet`, `card_neon_pink` |
|
|
115
|
+
| Cards · Minimal | 8 | `card_minimal_blue`, `card_minimal_violet`, `card_minimal_pink` |
|
|
116
|
+
| Cards · Ribbon | 8 | `card_ribbon_blue`, `card_ribbon_violet`, `card_ribbon_pink` |
|
|
117
|
+
| Cards · Dashed | 8 | `card_dashed_blue`, `card_dashed_violet`, `card_dashed_pink` |
|
|
118
|
+
| Cards · Underline | 8 | `card_underline_blue`, `card_underline_violet`, `card_underline_pink` |
|
|
119
|
+
| Callouts | 28 | `callout_info`, `callout_tip`, `callout_warning` |
|
|
120
|
+
| Callouts · Solid | 10 | `callout_info_solid`, `callout_tip_solid`, `callout_note_solid` |
|
|
121
|
+
| Callouts · Outline | 10 | `callout_info_outline`, `callout_tip_outline`, `callout_note_outline` |
|
|
122
|
+
| Callouts · Minimal | 10 | `callout_info_minimal`, `callout_tip_minimal`, `callout_note_minimal` |
|
|
123
|
+
| Lists | 20 | `list_style1`, `list_pills`, `list_ranked` |
|
|
124
|
+
| Lists · Themed | 9 | `list_style1_solid`, `list_style2_solid`, `list_style3_solid` |
|
|
125
|
+
| Checklists | 4 | `list_check`, `checklist_outline`, `checklist_boxed` |
|
|
126
|
+
| Steps | 5 | `steps`, `steps_solid`, `steps_outline` |
|
|
127
|
+
| Timelines | 5 | `timeline`, `timeline_solid`, `timeline_outline` |
|
|
128
|
+
| Numbers | 11 | `stats`, `progress`, `rating` |
|
|
129
|
+
| Grids & columns | 13 | `grid_2`, `grid_3`, `columns_2` |
|
|
130
|
+
| Boxes | 16 | `box_plain`, `box_terminal`, `note_paper` |
|
|
131
|
+
| Banners & heroes | 12 | `banner`, `hero`, `section_title` |
|
|
132
|
+
| Quotes | 5 | `quote_box`, `quote_pull`, `quote_card` |
|
|
133
|
+
| Collapsible | 7 | `details`, `details_open`, `faq_list` |
|
|
134
|
+
| Badges & tags | 5 | `badges`, `badges_tags`, `badges_square` |
|
|
135
|
+
| Tables & data | 11 | `keyvalue`, `table`, `pros_cons` |
|
|
136
|
+
|
|
137
|
+
Most ids read the way they look: `<family>_<theme>_<colour>`. The short,
|
|
138
|
+
memorable ones are aliased - `info`, `tip`, `warning`, `note`, `quote`,
|
|
139
|
+
`collapse`, `spoiler`, `kv`, `tags`, `terminal` and friends all work as types.
|
|
140
|
+
|
|
141
|
+
**Line formats.** Blocks that take one line per item split their fields on `::`:
|
|
142
|
+
|
|
143
|
+
| Type | Line format |
|
|
128
144
|
|---|---|
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
132
|
-
| `
|
|
133
|
-
| `
|
|
134
|
-
| `
|
|
135
|
-
| `
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
|
140
|
-
|
|
141
|
-
| `
|
|
142
|
-
| `
|
|
143
|
-
| `stats` | Row of big-number tiles | `value :: label` |
|
|
144
|
-
| `grid_2` | Two column grid of cards | cells split on `---` |
|
|
145
|
-
| `grid_3` | Three column grid of cards | cells split on `---` |
|
|
146
|
-
| `columns_2` | Two plain columns, no card chrome | cells split on `---` |
|
|
147
|
-
|
|
148
|
-
**Boxes**
|
|
149
|
-
|
|
150
|
-
| Type | Renders | Aliases |
|
|
151
|
-
|---|---|---|
|
|
152
|
-
| `box_plain` | Neutral box | |
|
|
153
|
-
| `box_dashed` | Dashed outline box | |
|
|
154
|
-
| `box_shadow` | Box with a drop shadow | |
|
|
155
|
-
| `banner` | Gradient banner, white text | |
|
|
156
|
-
| `hero` | Large centred hero section | |
|
|
157
|
-
| `highlight` | Thick coloured left strip | `highlight_box` |
|
|
158
|
-
|
|
159
|
-
**Special**
|
|
160
|
-
|
|
161
|
-
| Type | Renders | Aliases |
|
|
162
|
-
|---|---|---|
|
|
163
|
-
| `quote_box` | Pull quote; the title becomes the attribution | `quote` |
|
|
164
|
-
| `details` | Collapsible `<details>` section | `collapse`, `spoiler` |
|
|
165
|
-
| `details_open` | Collapsible, expanded by default | |
|
|
166
|
-
| `badges` | Row of pill badges, split on commas and newlines | |
|
|
167
|
-
| `keyvalue` | Two column key/value table (`key :: value`) | `kv`, `fields` |
|
|
145
|
+
| `steps` | `title :: description` |
|
|
146
|
+
| `timeline` | `when :: title :: description` |
|
|
147
|
+
| `stats` | `value :: label` |
|
|
148
|
+
| `progress` | `label :: 70` or `7/10` or `70%` |
|
|
149
|
+
| `rating` | `label :: 4` (out of five) or `8/10` |
|
|
150
|
+
| `keyvalue` | `key :: value` |
|
|
151
|
+
| `table` | `cell :: cell :: cell` - the first line is the header row |
|
|
152
|
+
| `pros_cons` | `+ a good thing` / `- a bad thing`, `:: Left :: Right` renames the columns |
|
|
153
|
+
| `faq_list` | `question :: answer` |
|
|
154
|
+
| `features_2` | `🚀 title :: description` |
|
|
155
|
+
| `chat` | `who :: message`, a leading `>` forces the message right |
|
|
156
|
+
| `badges` | split on commas and newlines |
|
|
157
|
+
| `list_*` | one item per line; `[x]` / `[ ]` for checkboxes, two spaces to nest |
|
|
158
|
+
| `grid_*`, `columns_*` | markdown cells split on a `---` line |
|
|
168
159
|
|
|
169
160
|
## Editor highlighting
|
|
170
161
|
|
|
@@ -192,27 +183,33 @@ To restyle a block yourself, target it in your userstyle:
|
|
|
192
183
|
|
|
193
184
|
## Adding your own block types
|
|
194
185
|
|
|
195
|
-
`
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
"titleHint": "Card title",
|
|
205
|
-
"bodyHint": "Card contents"
|
|
206
|
-
}
|
|
186
|
+
`tools/block-families.js` is the source of truth. It describes blocks by family -
|
|
187
|
+
a family being one shape crossed with a set of colours and themes - and
|
|
188
|
+
`npm run blocks` expands it into `src/blocks/blocks.json`, which is what ships.
|
|
189
|
+
Edit the families, never the JSON: the JSON is regenerated (and your edits lost)
|
|
190
|
+
on the next build.
|
|
191
|
+
|
|
192
|
+
```js
|
|
193
|
+
{ id: 'card_brown', label: 'Brown card', category: 'Cards', mode: 'card',
|
|
194
|
+
color: 'brown', titleHint: 'Card title', bodyHint: 'Card contents' },
|
|
207
195
|
```
|
|
208
196
|
|
|
209
197
|
...then `npm run dist`. The new type is immediately available in the parser, the
|
|
210
198
|
viewer stylesheet, the editor highlighter, the menus and the picker dialog -
|
|
211
|
-
there is nowhere else to register it.
|
|
199
|
+
there is nowhere else to register it. The generator refuses to write a registry
|
|
200
|
+
with a duplicate id or alias, an unknown mode or a missing colour, so a mistake
|
|
201
|
+
in a family fails the build rather than shipping.
|
|
202
|
+
|
|
203
|
+
A block is a **mode** (which renderer draws it) plus a **theme** (what the chrome
|
|
204
|
+
around it looks like). The two are independent - any theme works on any mode:
|
|
212
205
|
|
|
213
|
-
`mode
|
|
214
|
-
`
|
|
215
|
-
|
|
206
|
+
* `mode`: `card`, `callout`, `plain`, `quote`, `details`, `grid`, `list`,
|
|
207
|
+
`steps`, `timeline`, `stats`, `progress`, `rating`, `badges`, `keyvalue`,
|
|
208
|
+
`table`, `compare`, `faq`, `feature`, `chat`.
|
|
209
|
+
* `theme`: `soft` (the default), `solid`, `outline`, `gradient`, `elevated`,
|
|
210
|
+
`glass`, `neon`, `minimal`, `ribbon`, `dashed`, `underline`.
|
|
211
|
+
|
|
212
|
+
The remaining fields (`icon`, `defaultTitle`, `variant`, `listStyle`, `ordered`,
|
|
216
213
|
`columns`, `bare`, `open`, `aliases`) are documented in `src/blocks/types.ts`.
|
|
217
214
|
|
|
218
215
|
## Building
|
|
@@ -238,18 +235,32 @@ changes.
|
|
|
238
235
|
```
|
|
239
236
|
src/
|
|
240
237
|
index.ts main script: settings, commands, menus, picker dialog
|
|
238
|
+
picker.ts builds the picker dialog's HTML
|
|
241
239
|
blocks/
|
|
242
|
-
blocks.json the registry - every block type lives here
|
|
240
|
+
blocks.json the registry - generated, every block type lives here
|
|
243
241
|
types.ts registry types
|
|
244
242
|
syntax.ts the fence grammar, shared by viewer and editor
|
|
243
|
+
render.ts all HTML generation, shared by viewer and picker
|
|
244
|
+
preview.ts the picker's thumbnails, on top of render.ts
|
|
245
|
+
viewerCss.ts generated - the viewer stylesheet, as a string
|
|
245
246
|
index.ts lookup helpers and the snippet builder
|
|
246
247
|
markdownItPlugin/ markdown-it content script (the viewer)
|
|
247
248
|
codeMirrorPlugin/ CodeMirror 6 content script (the editor)
|
|
248
249
|
dialog/ assets for the block picker
|
|
249
250
|
tools/
|
|
251
|
+
block-families.js the block families - the source of truth
|
|
252
|
+
generate-blocks.js expands the families into blocks.json
|
|
250
253
|
generate-styles.js builds both stylesheets from the registry
|
|
251
254
|
styles/ hand written CSS the generator wraps
|
|
252
255
|
```
|
|
253
256
|
|
|
257
|
+
The picker's thumbnails go through `blocks/render.ts`, the same code the note
|
|
258
|
+
viewer uses, so a preview cannot drift away from what Joplin actually draws. The
|
|
259
|
+
generated viewer stylesheet is inlined into the dialog's HTML (as
|
|
260
|
+
`blocks/viewerCss.ts`) for the same reason: Joplin replaces a dialog's content
|
|
261
|
+
on every open, so the previews carry their own styling rather than depending on
|
|
262
|
+
a second file resolving inside the dialog frame.
|
|
263
|
+
|
|
264
|
+
`src/blocks/blocks.json`, `src/blocks/viewerCss.ts`,
|
|
254
265
|
`src/markdownItPlugin/style.css` and `src/codeMirrorPlugin/style.css` are
|
|
255
|
-
generated - edit `tools/styles/*.css` instead.
|
|
266
|
+
generated - edit `tools/block-families.js` and `tools/styles/*.css` instead.
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "joplin-plugin-html-blocks",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Write styled HTML sections - cards, callouts, fancy lists, steps, timelines, grids and more - using a simple `!!! type` ... `!!!->` markdown fence.",
|
|
5
5
|
"author": "madusanka",
|
|
6
6
|
"scripts": {
|
|
7
|
+
"blocks": "node tools/generate-blocks.js",
|
|
7
8
|
"styles": "node tools/generate-styles.js",
|
|
8
9
|
"manual": "node tools/generate-manual.js",
|
|
9
|
-
"dist": "npm run styles && webpack --env joplin-plugin-config=buildMain && webpack --env joplin-plugin-config=buildExtraScripts && webpack --env joplin-plugin-config=createArchive",
|
|
10
|
+
"dist": "npm run blocks && npm run styles && webpack --env joplin-plugin-config=buildMain && webpack --env joplin-plugin-config=buildExtraScripts && webpack --env joplin-plugin-config=createArchive",
|
|
10
11
|
"prepare": "npm run dist",
|
|
11
12
|
"updateVersion": "webpack --env joplin-plugin-config=updateVersion",
|
|
12
13
|
"update": "npm install -g generator-joplin && yo joplin --node-package-manager npm --update --force"
|
|
Binary file
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
"manifest_version": 1,
|
|
3
3
|
"id": "com.madusanka.htmlBlocks",
|
|
4
4
|
"app_min_version": "3.0.0",
|
|
5
|
-
"
|
|
5
|
+
"app_min_version_mobile": "3.1.0",
|
|
6
|
+
"platforms": [
|
|
7
|
+
"desktop",
|
|
8
|
+
"mobile"
|
|
9
|
+
],
|
|
10
|
+
"version": "1.0.6",
|
|
6
11
|
"name": "HTML Blocks",
|
|
7
12
|
"description": "Write styled HTML sections - cards, callouts, fancy lists, steps, timelines, grids and more - using a simple `!!! type` ... `!!!->` markdown fence.",
|
|
8
13
|
"author": "madusanka",
|
|
@@ -23,6 +28,6 @@
|
|
|
23
28
|
"screenshots": [],
|
|
24
29
|
"icons": {},
|
|
25
30
|
"promo_tile": {},
|
|
26
|
-
"_publish_hash": "sha256:
|
|
27
|
-
"_publish_commit": "main:
|
|
31
|
+
"_publish_hash": "sha256:990d5ec766ddae0ef129bf5c4818809d1cfdd66325f966b35ef2a75649db2683",
|
|
32
|
+
"_publish_commit": "main:a2e1c8468acbe7994c44a0ab5b1b1ad3b5c3d597"
|
|
28
33
|
}
|