@sveltia/ui 0.31.11 → 0.31.12

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.
@@ -20,7 +20,10 @@ export const splitMultilineFormatting = (value) =>
20
20
  * @see https://github.com/sveltia/sveltia-cms/issues/599
21
21
  */
22
22
  export const fixMarkdownFormatting = (value) =>
23
- value.replace(/\*\*(\S+?) \*\*/gm, '**$1** ').replace(/_(\S+?) _/gm, '_$1_ ');
23
+ value
24
+ .replace(/\*\*(\S+?) \*\*/gm, '**$1** ')
25
+ .replace(/_(\S+?) _/gm, '_$1_ ')
26
+ .replace(/~~(\S+?) ~~/gm, '~~$1~~ ');
24
27
 
25
28
  /**
26
29
  * Increase list indentation levels to prevent Markdown parsing issues.
@@ -113,6 +113,24 @@ describe('fixMarkdownFormatting', () => {
113
113
  'snake_case_variable **foo** bar',
114
114
  );
115
115
  });
116
+
117
+ it('should fix unclosed strikethrough markers with space in between', () => {
118
+ expect(fixMarkdownFormatting('~~foo ~~bar')).toBe('~~foo~~ bar');
119
+ });
120
+
121
+ it('should fix multiple strikethrough markers', () => {
122
+ expect(fixMarkdownFormatting('~~foo ~~bar ~~baz ~~qux')).toBe('~~foo~~ bar ~~baz~~ qux');
123
+ });
124
+
125
+ it('should fix mixed formatting with strikethrough', () => {
126
+ expect(fixMarkdownFormatting('**bold **text _italic _text ~~strike ~~text')).toBe(
127
+ '**bold** text _italic_ text ~~strike~~ text',
128
+ );
129
+ });
130
+
131
+ it('should not affect properly closed strikethrough markers', () => {
132
+ expect(fixMarkdownFormatting('~~foo~~ bar')).toBe('~~foo~~ bar');
133
+ });
116
134
  });
117
135
 
118
136
  describe('increaseListIndentation', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltia/ui",
3
- "version": "0.31.11",
3
+ "version": "0.31.12",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {