@inditextech/docouture-antora-extensions 1.1.0 → 1.1.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/lib/changelog-pages.js +16 -1
- package/lib/changelog-pages.spec.js +13 -0
- package/package.json +2 -2
package/lib/changelog-pages.js
CHANGED
|
@@ -194,7 +194,7 @@ function convertBody(lines, logger, versionLabel) {
|
|
|
194
194
|
}
|
|
195
195
|
const bullet = line.match(/^-\s+\[#(\d+)\]\((\S+?)\)\s*(.*)$/)
|
|
196
196
|
if (bullet) {
|
|
197
|
-
out.push(`* link:${bullet[2]}[#${bullet[1]}] ${bullet[3]}`.trimEnd())
|
|
197
|
+
out.push(`* link:${bullet[2]}[#${bullet[1]}] ${unescapeMarkdownBrackets(bullet[3])}`.trimEnd())
|
|
198
198
|
continue
|
|
199
199
|
}
|
|
200
200
|
// Keep a Changelog reference-style link definitions, e.g.
|
|
@@ -214,6 +214,21 @@ function convertBody(lines, logger, versionLabel) {
|
|
|
214
214
|
return out.join('\n')
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
+
// This repo's own CHANGELOG.md convention escapes a leading `[type]` tag as
|
|
218
|
+
// `\[type]` (e.g. `\[cli] Add docouture new`) — a Markdown-only concern:
|
|
219
|
+
// GitHub renders CHANGELOG.md as Markdown, where a bare `[foo]` can be read
|
|
220
|
+
// as the start of a reference-style link, so contributors escape it there.
|
|
221
|
+
// AsciiDoc has no equivalent meaning for `\[` — a bare `[...]` in running
|
|
222
|
+
// prose isn't special syntax — so Asciidoctor doesn't strip the backslash
|
|
223
|
+
// either; left alone, it renders as a literal `\` character on the
|
|
224
|
+
// changelog page (GH #223). `\*`/`\_`/`` \` ``/etc are deliberately left
|
|
225
|
+
// untouched here: those escape AsciiDoc's own quoted-text formatting marks
|
|
226
|
+
// the same way they escape Markdown's, so passing them through unchanged is
|
|
227
|
+
// already correct.
|
|
228
|
+
function unescapeMarkdownBrackets(text) {
|
|
229
|
+
return text.replace(/\\([[\]])/g, '$1')
|
|
230
|
+
}
|
|
231
|
+
|
|
217
232
|
// `isPrerelease` is only true for the component version Antora flagged
|
|
218
233
|
// `prerelease: true` (see `isPrereleaseVersion` above) — the version built
|
|
219
234
|
// from `main`, still under active development and never itself tagged. Its
|
|
@@ -157,6 +157,19 @@ describe('registerChangelogPages', () => {
|
|
|
157
157
|
expect(source).toContain('* link:https://github.com/InditexTech/x/pull/98[#98] [cli] Fix a crash')
|
|
158
158
|
})
|
|
159
159
|
|
|
160
|
+
it('unescapes a Markdown-escaped `\\[type]` tag instead of rendering the backslash literally (GH-223)', async () => {
|
|
161
|
+
const { dir } = writeChangelog(
|
|
162
|
+
'# Changelog\n\n## [1.0.0] - 2026-01-15\n\n### Added\n\n' +
|
|
163
|
+
'- [#100](https://github.com/InditexTech/x/pull/100) \\[cli] Add docouture new\n'
|
|
164
|
+
)
|
|
165
|
+
const indexFile = createIndexFile('ROOT', 'prerelease', 'main')
|
|
166
|
+
await run('CHANGELOG.md', { files: [indexFile], playbookDir: dir })
|
|
167
|
+
|
|
168
|
+
const source = indexFile.contents.toString()
|
|
169
|
+
expect(source).toContain('* link:https://github.com/InditexTech/x/pull/100[#100] [cli] Add docouture new')
|
|
170
|
+
expect(source).not.toContain('\\[cli]')
|
|
171
|
+
})
|
|
172
|
+
|
|
160
173
|
it('appends a "no tagged release yet" placeholder on a real version when nothing has been cut', async () => {
|
|
161
174
|
const { dir } = writeChangelog('# Changelog\n\n## [Unreleased]\n\n### Added\n\n- [#1](url) thing\n')
|
|
162
175
|
const indexFile = createIndexFile('ROOT', 'stable', 'main') // a real, tagged version — never shows Unreleased
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inditextech/docouture-antora-extensions",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Antora pipeline extensions shared by docouture documentation sites — per-module navigation metadata (nav_modules)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@shikijs/themes": "~4.4.0",
|
|
28
28
|
"node-html-parser": "^9.0.1",
|
|
29
29
|
"shiki": "~4.4.0",
|
|
30
|
-
"@inditextech/docouture-asciidoc-extensions": "1.1.
|
|
30
|
+
"@inditextech/docouture-asciidoc-extensions": "1.1.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@antora/content-classifier": "~3.2.0"
|