@mirrordown/sat-caption 0.2.0 → 0.2.1

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/CHANGELOG.md CHANGED
@@ -1,6 +1,100 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+
5
+ ## 0.2.1
6
+ <sub>2026-11-17</sub>
7
+
8
+ - *(patch)*
9
+ Fixes for `~:` caption lines the three engines found in different places, or not at all.
10
+
11
+ - **A caption is found after emphasis or a code span that spans lines** (all engines).
12
+
13
+ ```markdown
14
+ *emph
15
+ more* text
16
+ ~: caption
17
+ ```
18
+
19
+ Was, in remark and Sätteri, one paragraph ending in the text `~: caption`. Now a figure around the paragraph with `<figcaption>caption</figcaption>`, as in markdown-it. After a code span that spans lines (`` `a `` then `` b` text ``) no engine found the caption; all three do now.
20
+
21
+ - **A `~:` inside emphasis or a link's text is text** (markdown-it).
22
+
23
+ ```markdown
24
+ ![i](a.jpg) *foo
25
+ ~: bar*
26
+ ```
27
+
28
+ Was unbalanced HTML: `<p>… <em>foo</p><figcaption>bar</em></figcaption>`. Now the paragraph `<p><img …> <em>foo\n~: bar</em></p>`, as in remark and Sätteri. The same goes for a link whose text holds the line break.
29
+
30
+ - **A caption in a task-list item captions the task, not the list** (remark, Sätteri).
31
+
32
+ ```markdown
33
+ - [ ] Task
34
+ ~: cap
35
+ - [ ] Two
36
+ ```
37
+
38
+ Was one figure around the whole list. Now a figure in the first item, `<figure class="markdown-caption"><p>Task</p><figcaption>cap</figcaption></figure>`, as a caption in any other list item renders. The same was wrong for an item whose content starts on the line after its marker.
39
+
40
+ - **A `text-align` style written on a caption is kept** (markdown-it), with the attrs plugin.
41
+
42
+ ```markdown
43
+ ![x](a.jpg)
44
+ ~: cap {style="text-align:center"}
45
+ ```
46
+
47
+ Was `<figure class="markdown-caption">`, the style dropped. Now `<figure class="markdown-caption" style="text-align:center">`, as in remark and Sätteri. A style on a table's caption is kept as well.
48
+
49
+ - **A caption after a `prompt` block wraps the whole prompt** (markdown-it), with the prompt plugin.
50
+
51
+ ````markdown
52
+ ```prompt
53
+ Do the thing
54
+ ```
55
+ ~: A prompt
56
+ ````
57
+
58
+ Was a `<figure>` opened inside the prompt's preview and closed outside the prompt. Now `<figure class="markdown-caption"><div class="markdown-prompt">…</div><figcaption>A prompt</figcaption></figure>`, as in remark and Sätteri.
59
+
60
+ - **A caption line after a link reference definition captions nothing, however the definition is written** (markdown-it).
61
+
62
+ ````markdown
63
+ ```
64
+ code
65
+ ```
66
+ [a]:
67
+ b
68
+ ~: cap
69
+ ````
70
+
71
+ Was a figure around the code block. Now the code block followed by `<p>~: cap</p>`, as in remark and Sätteri, because the definition stands between the two.
72
+
73
+ - **Indented code that looks like a link reference definition takes its caption** (markdown-it).
74
+
75
+ ```markdown
76
+ Indented:
77
+
78
+ [home]: x
79
+ ~: A caption
80
+ ```
81
+
82
+ Was the code block followed by `<p>~: A caption</p>`. Now a figure around the code block, as in remark and Sätteri.
83
+
84
+ - **A backslash ending an inner caption, before an outer caption line, is not a line break** (remark, Sätteri).
85
+
86
+ ```markdown
87
+ > > Inner
88
+ > ~: inner\
89
+ ~: outer
90
+ ```
91
+
92
+ Was `<figcaption>inner<br></figcaption>`. Now `<figcaption>inner</figcaption>`, as in markdown-it.
93
+
94
+ - **Carriage returns never reach the output** (remark, Sätteri). In a document with CRLF line endings, a captioned paragraph of several lines ended in a carriage return; in one with lone CR line endings, no caption was found. Both now render as they do with LF.
95
+
96
+ The guide now says where a caption's rules stop holding.
97
+
4
98
  ## 0.2.0
5
99
  <sub>2026-11-11</sub>
6
100
 
package/README.md CHANGED
@@ -63,7 +63,7 @@ npm install @mirrordown/remd-caption
63
63
  ~: One plugin per engine
64
64
  ````
65
65
 
66
- A table reads the caption line as a row of its own, so a table's caption can't contain a `|` (write `\|`).
66
+ A table reads the caption line as a row of its own, so a table's caption can't contain a `|` (write `\|`): the caption ends at an unescaped one, and the text after it is dropped.
67
67
 
68
68
  ### Any other block
69
69
 
@@ -90,9 +90,13 @@ A caption goes on the block it's written after, at the level its `>` markers and
90
90
 
91
91
  The caption runs to the end of its paragraph, so a `~:` on a later line at the same level is part of it. A caption doesn't attach to a heading, a thematic break, raw HTML, or another caption, and a `~:` after a blank line is text, so a caption always touches its block.
92
92
 
93
+ One case reads differently today: after a captioned code fence inside a quote or list item, a `~:` line written outside is taken as more of the fence's caption, not as a caption for the quote or the list.
94
+
95
+ With [subscript](/guide/plugins/sub) on, a `~` later on the caption's line pairs with the marker's as a subscript, and the line stops being a caption. Escape it (`\~`) to keep the caption.
96
+
93
97
  ### Attributes
94
98
 
95
- With the [`attrs`](/guide/plugins/attrs) plugin, attributes written at the end of a caption go on the figure, which gives it an id to link to. A block keeps its own attributes.
99
+ With the [`attrs`](/guide/plugins/attrs) plugin, attributes written at the end of a caption go on the figure, which gives it an id to link to. In a caption of several lines, that is the end of its last line; a block ending an earlier line stays text. A block keeps its own attributes.
96
100
 
97
101
  ````markdown
98
102
  ![Wild rice growing in a marsh](./assets/wild-rice.jpg){.photo}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mirrordown/sat-caption",
3
3
  "description": "A Sätteri plugin to caption any block with a ~: line after it, wrapping it in <figure> with a <figcaption>.",
4
- "version": "0.2.0",
4
+ "version": "0.2.1",
5
5
  "license": "MIT",
6
6
  "author": "Drake Costa <drake@saeris.io> (https://saeris.gg)",
7
7
  "repository": {
@@ -21,7 +21,7 @@
21
21
  "./*.css": "./dist/*.css"
22
22
  },
23
23
  "dependencies": {
24
- "@mirrordown/core": "^0.1.4"
24
+ "@mirrordown/core": "^0.2.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "satteri": "^0.11.6"