joplin-plugin-html-blocks 1.0.1 → 1.0.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,3 +1,5 @@
1
+ <img src="images/icon128.png" width="96" align="right" alt="HTML Blocks icon">
2
+
1
3
  # HTML Blocks - a Joplin plugin
2
4
 
3
5
  Write styled HTML sections in your notes with a simple markdown fence. No HTML,
@@ -10,9 +12,25 @@ Card contents, with the usual **markdown** you'd expect.
10
12
  ```
11
13
 
12
14
  ...renders as a light blue card in the note viewer, in exported HTML and in PDF
13
- exports. 47 block types are included: cards, admonition-style callouts, six list
14
- styles, steps, timelines, stat tiles, grids, banners, collapsible sections and
15
- more.
15
+ exports. 298 block types are included, in 28 categories: cards in eleven styles,
16
+ admonition-style callouts, twenty-two list styles, steps, timelines, stat tiles,
17
+ progress bars, ratings, tables, pros and cons, FAQs, feature grids, chat
18
+ transcripts, grids, banners, collapsible sections and more.
19
+
20
+ ## Screenshots
21
+
22
+ ![The block picker](screenshots/01-block-picker.png)
23
+
24
+ *The picker: filter 298 blocks by name, id, colour or theme, and insert one with
25
+ a click.*
26
+
27
+ ![Card blocks in the note viewer](screenshots/02-card-blocks.png)
28
+
29
+ *Cards in the note viewer - solid, outline, tinted, gradient and elevated.*
30
+
31
+ ![Checklists, stat tiles and grids](screenshots/03-lists-stats-grids.png)
32
+
33
+ *Checklists, stat tiles, badge rows, grids and key/value tables.*
16
34
 
17
35
  ## Installation
18
36
 
@@ -22,7 +40,7 @@ later on desktop.
22
40
 
23
41
  ## Documentation
24
42
 
25
- [**User manual (PDF)**](docs/HTML-Blocks-Manual.pdf) - 20 pages covering every
43
+ [**User manual (PDF)**](docs/HTML-Blocks-Manual.pdf) - 89 pages covering every
26
44
  block, with a rendered preview beside the markdown for each one. It is generated
27
45
  by the plugin's own renderer via `npm run manual`, so the previews always match
28
46
  what Joplin actually draws.
@@ -47,7 +65,8 @@ what Joplin actually draws.
47
65
  in the corner) instead of silently vanishing.
48
66
 
49
67
  Most blocks treat their contents as ordinary markdown. The list-like ones
50
- (`list_*`, `steps`, `timeline`, `stats`, `keyvalue`, `badges`) treat **one line
68
+ (`list_*`, `steps`, `timeline`, `stats`, `progress`, `rating`, `keyvalue`,
69
+ `table`, `pros_cons`, `faq_*`, `features_*`, `chat`, `badges`) treat **one line
51
70
  as one item** instead, and split fields on `::`:
52
71
 
53
72
  ```
@@ -76,95 +95,84 @@ Right hand contents
76
95
 
77
96
  Three ways, whichever suits you:
78
97
 
79
- * **Toolbar button** in the editor, or **Ctrl+Alt+H** - opens a searchable
80
- picker. If you had text selected, it becomes the body of the new block.
98
+ * **Toolbar button** in the editor, or **Ctrl+Alt+H** - opens the picker. If you
99
+ had text selected, it becomes the body of the new block.
81
100
  * **Tools → HTML Blocks** - every block, grouped by category.
82
101
  * **Command palette** - type "Insert block" and the block name.
83
102
 
103
+ The picker shows each block as a **live preview** rather than a name: every tile
104
+ is the real block, drawn by the same renderer the note viewer uses, so what you
105
+ see in the dialog is what lands in the note. It opens on the blocks you reached
106
+ for most recently, and the sidebar walks the categories. Typing filters across
107
+ every category at once - by name, id, colour, mode or theme - the arrow keys walk
108
+ the grid, and a double click inserts straight away.
109
+
110
+ Previews can be turned off in *Tools → Options → HTML Blocks* if you would rather
111
+ have a plain list of names.
112
+
84
113
  **Tools → HTML Blocks → Insert cheat sheet** drops one example of every single
85
114
  block type into the current note, which is the quickest way to see what they all
86
115
  look like.
87
116
 
88
117
  ## Block reference
89
118
 
90
- **Cards** - a titled, tinted box with a coloured left edge.
119
+ There are too many block types to list one by one here - the picker shows every
120
+ one of them as a preview, and the [user manual](docs/HTML-Blocks-Manual.pdf)
121
+ pairs each one with its markdown. The categories are:
91
122
 
92
- | Type | Renders | Aliases |
93
- |---|---|---|
94
- | `card_light_blue` | Light blue card | `card_lightblue`, `card_sky` |
95
- | `card_blue` | Blue card | |
96
- | `card_indigo` | Indigo card | |
97
- | `card_teal` | Teal card | |
98
- | `card_green` | Green card | |
99
- | `card_light_green` | Light green card | `card_lightgreen`, `card_lime` |
100
- | `card_yellow` | Yellow card | |
101
- | `card_orange` | Orange card | |
102
- | `card_red` | Red card | |
103
- | `card_pink` | Pink card | |
104
- | `card_purple` | Purple card | |
105
- | `card_gray` | Gray card | `card_grey` |
106
- | `card_dark` | Dark card | |
107
-
108
- **Callouts** - like cards, but with an icon and a default title, in the style of
109
- the admonition plugin.
110
-
111
- | Type | Renders | Aliases |
123
+ | Category | Blocks | For example |
112
124
  |---|---|---|
113
- | `callout_info` | ℹ️ Info | `info` |
114
- | `callout_tip` | 💡 Tip | `tip`, `hint` |
115
- | `callout_note` | 📝 Note | `note` |
116
- | `callout_success` | Success | `success`, `done` |
117
- | `callout_warning` | ⚠️ Warning | `warning`, `caution` |
118
- | `callout_danger` | Danger | `danger`, `error` |
119
- | `callout_question` | Question | `question`, `faq` |
120
- | `callout_example` | 🧪 Example | `example` |
121
- | `callout_bug` | 🐛 Bug | `bug` |
122
- | `callout_todo` | 📌 To do | `todo` |
123
-
124
- **Lists** - one line per item. A leading `-` is optional, and two spaces of
125
- indentation nests an item one level (up to three).
126
-
127
- | Type | Renders |
125
+ | Cards | 21 | `card_light_blue`, `card_blue`, `card_indigo` |
126
+ | Cards · Solid | 12 | `card_solid_blue`, `card_solid_indigo`, `card_solid_violet` |
127
+ | Cards · Outline | 12 | `card_outline_blue`, `card_outline_indigo`, `card_outline_violet` |
128
+ | Cards · Gradient | 12 | `card_gradient_blue`, `card_gradient_indigo`, `card_gradient_violet` |
129
+ | Cards · Elevated | 12 | `card_elevated_blue`, `card_elevated_indigo`, `card_elevated_violet` |
130
+ | Cards · Glass | 8 | `card_glass_blue`, `card_glass_violet`, `card_glass_pink` |
131
+ | Cards · Neon | 8 | `card_neon_blue`, `card_neon_violet`, `card_neon_pink` |
132
+ | Cards · Minimal | 8 | `card_minimal_blue`, `card_minimal_violet`, `card_minimal_pink` |
133
+ | Cards · Ribbon | 8 | `card_ribbon_blue`, `card_ribbon_violet`, `card_ribbon_pink` |
134
+ | Cards · Dashed | 8 | `card_dashed_blue`, `card_dashed_violet`, `card_dashed_pink` |
135
+ | Cards · Underline | 8 | `card_underline_blue`, `card_underline_violet`, `card_underline_pink` |
136
+ | Callouts | 28 | `callout_info`, `callout_tip`, `callout_warning` |
137
+ | Callouts · Solid | 10 | `callout_info_solid`, `callout_tip_solid`, `callout_note_solid` |
138
+ | Callouts · Outline | 10 | `callout_info_outline`, `callout_tip_outline`, `callout_note_outline` |
139
+ | Callouts · Minimal | 10 | `callout_info_minimal`, `callout_tip_minimal`, `callout_note_minimal` |
140
+ | Lists | 20 | `list_style1`, `list_pills`, `list_ranked` |
141
+ | Lists · Themed | 9 | `list_style1_solid`, `list_style2_solid`, `list_style3_solid` |
142
+ | Checklists | 4 | `list_check`, `checklist_outline`, `checklist_boxed` |
143
+ | Steps | 5 | `steps`, `steps_solid`, `steps_outline` |
144
+ | Timelines | 5 | `timeline`, `timeline_solid`, `timeline_outline` |
145
+ | Numbers | 11 | `stats`, `progress`, `rating` |
146
+ | Grids & columns | 13 | `grid_2`, `grid_3`, `columns_2` |
147
+ | Boxes | 16 | `box_plain`, `box_terminal`, `note_paper` |
148
+ | Banners & heroes | 12 | `banner`, `hero`, `section_title` |
149
+ | Quotes | 5 | `quote_box`, `quote_pull`, `quote_card` |
150
+ | Collapsible | 7 | `details`, `details_open`, `faq_list` |
151
+ | Badges & tags | 5 | `badges`, `badges_tags`, `badges_square` |
152
+ | Tables & data | 11 | `keyvalue`, `table`, `pros_cons` |
153
+
154
+ Most ids read the way they look: `<family>_<theme>_<colour>`. The short,
155
+ memorable ones are aliased - `info`, `tip`, `warning`, `note`, `quote`,
156
+ `collapse`, `spoiler`, `kv`, `tags`, `terminal` and friends all work as types.
157
+
158
+ **Line formats.** Blocks that take one line per item split their fields on `::`:
159
+
160
+ | Type | Line format |
128
161
  |---|---|
129
- | `list_style1` | Coloured dot bullets |
130
- | `list_style2` | Numbered circles |
131
- | `list_style3` | Check marks |
132
- | `list_style4` | Arrows |
133
- | `list_style5` | Boxed rows |
134
- | `list_style6` | Rows separated by rules |
135
- | `list_check` | Checkboxes - prefix a line with `[x]` or `[ ]` |
136
-
137
- **Layout**
138
-
139
- | Type | Renders | Line format |
140
- |---|---|---|
141
- | `steps` | Numbered steps joined by a rail | `title :: description` |
142
- | `timeline` | Vertical timeline | `when :: title :: description` |
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` |
162
+ | `steps` | `title :: description` |
163
+ | `timeline` | `when :: title :: description` |
164
+ | `stats` | `value :: label` |
165
+ | `progress` | `label :: 70` or `7/10` or `70%` |
166
+ | `rating` | `label :: 4` (out of five) or `8/10` |
167
+ | `keyvalue` | `key :: value` |
168
+ | `table` | `cell :: cell :: cell` - the first line is the header row |
169
+ | `pros_cons` | `+ a good thing` / `- a bad thing`, `:: Left :: Right` renames the columns |
170
+ | `faq_list` | `question :: answer` |
171
+ | `features_2` | `🚀 title :: description` |
172
+ | `chat` | `who :: message`, a leading `>` forces the message right |
173
+ | `badges` | split on commas and newlines |
174
+ | `list_*` | one item per line; `[x]` / `[ ]` for checkboxes, two spaces to nest |
175
+ | `grid_*`, `columns_*` | markdown cells split on a `---` line |
168
176
 
169
177
  ## Editor highlighting
170
178
 
@@ -192,27 +200,33 @@ To restyle a block yourself, target it in your userstyle:
192
200
 
193
201
  ## Adding your own block types
194
202
 
195
- `src/blocks/blocks.json` is the single source of truth. Add an entry:
196
-
197
- ```json
198
- {
199
- "id": "card_brown",
200
- "label": "Brown card",
201
- "category": "Cards",
202
- "mode": "card",
203
- "color": "#92400e",
204
- "titleHint": "Card title",
205
- "bodyHint": "Card contents"
206
- }
203
+ `tools/block-families.js` is the source of truth. It describes blocks by family -
204
+ a family being one shape crossed with a set of colours and themes - and
205
+ `npm run blocks` expands it into `src/blocks/blocks.json`, which is what ships.
206
+ Edit the families, never the JSON: the JSON is regenerated (and your edits lost)
207
+ on the next build.
208
+
209
+ ```js
210
+ { id: 'card_brown', label: 'Brown card', category: 'Cards', mode: 'card',
211
+ color: 'brown', titleHint: 'Card title', bodyHint: 'Card contents' },
207
212
  ```
208
213
 
209
214
  ...then `npm run dist`. The new type is immediately available in the parser, the
210
215
  viewer stylesheet, the editor highlighter, the menus and the picker dialog -
211
- there is nowhere else to register it.
216
+ there is nowhere else to register it. The generator refuses to write a registry
217
+ with a duplicate id or alias, an unknown mode or a missing colour, so a mistake
218
+ in a family fails the build rather than shipping.
212
219
 
213
- `mode` picks the renderer: `card`, `callout`, `plain`, `quote`, `details`,
214
- `grid`, `list`, `steps`, `timeline`, `stats`, `badges` or `keyvalue`. The
215
- remaining fields (`icon`, `defaultTitle`, `variant`, `listStyle`, `ordered`,
220
+ A block is a **mode** (which renderer draws it) plus a **theme** (what the chrome
221
+ around it looks like). The two are independent - any theme works on any mode:
222
+
223
+ * `mode`: `card`, `callout`, `plain`, `quote`, `details`, `grid`, `list`,
224
+ `steps`, `timeline`, `stats`, `progress`, `rating`, `badges`, `keyvalue`,
225
+ `table`, `compare`, `faq`, `feature`, `chat`.
226
+ * `theme`: `soft` (the default), `solid`, `outline`, `gradient`, `elevated`,
227
+ `glass`, `neon`, `minimal`, `ribbon`, `dashed`, `underline`.
228
+
229
+ The remaining fields (`icon`, `defaultTitle`, `variant`, `listStyle`, `ordered`,
216
230
  `columns`, `bare`, `open`, `aliases`) are documented in `src/blocks/types.ts`.
217
231
 
218
232
  ## Building
@@ -238,18 +252,32 @@ changes.
238
252
  ```
239
253
  src/
240
254
  index.ts main script: settings, commands, menus, picker dialog
255
+ picker.ts builds the picker dialog's HTML
241
256
  blocks/
242
- blocks.json the registry - every block type lives here
257
+ blocks.json the registry - generated, every block type lives here
243
258
  types.ts registry types
244
259
  syntax.ts the fence grammar, shared by viewer and editor
260
+ render.ts all HTML generation, shared by viewer and picker
261
+ preview.ts the picker's thumbnails, on top of render.ts
262
+ viewerCss.ts generated - the viewer stylesheet, as a string
245
263
  index.ts lookup helpers and the snippet builder
246
264
  markdownItPlugin/ markdown-it content script (the viewer)
247
265
  codeMirrorPlugin/ CodeMirror 6 content script (the editor)
248
266
  dialog/ assets for the block picker
249
267
  tools/
268
+ block-families.js the block families - the source of truth
269
+ generate-blocks.js expands the families into blocks.json
250
270
  generate-styles.js builds both stylesheets from the registry
251
271
  styles/ hand written CSS the generator wraps
252
272
  ```
253
273
 
274
+ The picker's thumbnails go through `blocks/render.ts`, the same code the note
275
+ viewer uses, so a preview cannot drift away from what Joplin actually draws. The
276
+ generated viewer stylesheet is inlined into the dialog's HTML (as
277
+ `blocks/viewerCss.ts`) for the same reason: Joplin replaces a dialog's content
278
+ on every open, so the previews carry their own styling rather than depending on
279
+ a second file resolving inside the dialog frame.
280
+
281
+ `src/blocks/blocks.json`, `src/blocks/viewerCss.ts`,
254
282
  `src/markdownItPlugin/style.css` and `src/codeMirrorPlugin/style.css` are
255
- generated - edit `tools/styles/*.css` instead.
283
+ generated - edit `tools/block-families.js` and `tools/styles/*.css` instead.
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "joplin-plugin-html-blocks",
3
- "version": "1.0.1",
3
+ "version": "1.0.7",
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",
9
+ "icons": "node tools/generate-icons.js",
8
10
  "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",
11
+ "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
12
  "prepare": "npm run dist",
11
13
  "updateVersion": "webpack --env joplin-plugin-config=updateVersion",
12
14
  "update": "npm install -g generator-joplin && yo joplin --node-package-manager npm --update --force"
@@ -7,7 +7,7 @@
7
7
  "desktop",
8
8
  "mobile"
9
9
  ],
10
- "version": "1.0.1",
10
+ "version": "1.0.7",
11
11
  "name": "HTML Blocks",
12
12
  "description": "Write styled HTML sections - cards, callouts, fancy lists, steps, timelines, grids and more - using a simple `!!! type` ... `!!!->` markdown fence.",
13
13
  "author": "madusanka",
@@ -25,9 +25,30 @@
25
25
  "viewer",
26
26
  "appearance"
27
27
  ],
28
- "screenshots": [],
29
- "icons": {},
30
- "promo_tile": {},
31
- "_publish_hash": "sha256:cb9c2385494e1253f96d4014df0f414ccbfb2f35891815d487dc456aa09fa422",
28
+ "screenshots": [
29
+ {
30
+ "src": "screenshots/01-block-picker.png",
31
+ "label": "The block picker: filter 298 blocks by name, id, colour or theme and insert one with a click"
32
+ },
33
+ {
34
+ "src": "screenshots/02-card-blocks.png",
35
+ "label": "Card blocks in the note viewer - solid, outline, tinted, gradient and elevated styles"
36
+ },
37
+ {
38
+ "src": "screenshots/03-lists-stats-grids.png",
39
+ "label": "Checklists, stat tiles, badge rows, grids and key/value tables"
40
+ }
41
+ ],
42
+ "icons": {
43
+ "16": "images/icon16.png",
44
+ "32": "images/icon32.png",
45
+ "48": "images/icon48.png",
46
+ "128": "images/icon128.png"
47
+ },
48
+ "promo_tile": {
49
+ "src": "images/promo_tile.png",
50
+ "label": "HTML Blocks - styled cards, callouts and lists from a simple markdown fence"
51
+ },
52
+ "_publish_hash": "sha256:648180bec6410312cf0f2cc1365ccfe39303cf76c490bb42de9233fc0c5ef187",
32
53
  "_publish_commit": "main:a2e1c8468acbe7994c44a0ab5b1b1ad3b5c3d597"
33
54
  }