@peaceroad/markdown-it-strong-ja 0.6.0 → 0.6.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.
Files changed (2) hide show
  1. package/index.js +6 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2277,15 +2277,15 @@ const mditStrongJa = (md, option) => {
2277
2277
  const token = state.tokens[i]
2278
2278
  if (!token || token.type !== 'inline' || !token.children || token.children.length === 0) continue
2279
2279
  let idx = token.children.length - 1
2280
- while (idx >= 0 && token.children[idx] && token.children[idx].type !== 'text') {
2280
+ while (idx >= 0 && (!token.children[idx] || (token.children[idx].type === 'text' && token.children[idx].content === ''))) {
2281
2281
  idx--
2282
2282
  }
2283
2283
  if (idx < 0) continue
2284
- const child = token.children[idx]
2285
- if (!child.content) continue
2286
- const trimmed = child.content.replace(/[ \t]+$/, '')
2287
- if (trimmed !== child.content) {
2288
- child.content = trimmed
2284
+ const tail = token.children[idx]
2285
+ if (!tail || tail.type !== 'text' || !tail.content) continue
2286
+ const trimmed = tail.content.replace(/[ \t]+$/, '')
2287
+ if (trimmed !== tail.content) {
2288
+ tail.content = trimmed
2289
2289
  }
2290
2290
  }
2291
2291
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@peaceroad/markdown-it-strong-ja",
3
3
  "description": "This is a plugin for markdown-it. It is an alternative to the standard `**` (strong) and `*` (em) processing. It also processes strings that cannot be converted by the standard.",
4
- "version": "0.6.0",
4
+ "version": "0.6.1",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "files": [