@redpanda-data/docs-extensions-and-macros 5.48.1 → 5.50.0
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/bin/doc-tools.js +87 -0
- package/package.json +1 -1
- package/tools/lint-strings/diff.js +8 -1
- package/tools/lint-strings/index.js +324 -28
- package/tools/lint-strings/rules/common.js +9 -2
- package/tools/lint-strings/surfaces/api.js +18 -0
- package/tools/lint-strings/surfaces/connect.js +12 -0
- package/tools/lint-strings/surfaces/crd.js +11 -0
- package/tools/lint-strings/surfaces/helm.js +10 -0
- package/tools/lint-strings/surfaces/metrics.js +30 -3
- package/tools/lint-strings/surfaces/properties.js +6 -0
- package/tools/lint-strings/surfaces/rpk.js +20 -1
- package/tools/overrides-audit/classify.js +6 -2
- package/tools/overrides-audit/report.js +169 -0
- package/tools/overrides-audit/triage.js +225 -0
- package/tools/property-extractor/README.adoc +10 -9
- package/tools/property-extractor/transformers.py +26 -0
- package/tools/rpk-docs/generate-rpk-docs.js +38 -4
|
@@ -1569,6 +1569,26 @@ function formatDescription(desc, customTransformations = null, options = {}) {
|
|
|
1569
1569
|
return placeholder
|
|
1570
1570
|
})
|
|
1571
1571
|
|
|
1572
|
+
// Bare URLs become inline code: endpoints (http://localhost:9644) and links
|
|
1573
|
+
// alike are code values, and an unformatted URL in help prose reads as
|
|
1574
|
+
// broken markup. Not trailing sentence punctuation, and not a URL that is
|
|
1575
|
+
// already an AsciiDoc link macro (url[text]), which backticks would break.
|
|
1576
|
+
//
|
|
1577
|
+
// Protected as a placeholder straight away, before any other pass runs.
|
|
1578
|
+
// Every later pass matches inside a URL it does not know is one: the path
|
|
1579
|
+
// passes backticked /tmp/file out of https://host/tmp/file, the short-flag
|
|
1580
|
+
// pass took -a out of /foo-a/, and the issue-reference pass rewrote #NNNN
|
|
1581
|
+
// anchors into link macros.
|
|
1582
|
+
protectedDesc = protectedDesc.replace(/(?<![`\w/]|\]\()https?:\/\/[^\s`<>"'()[\]]+/g, (url, offset, whole) => {
|
|
1583
|
+
if (whole[offset + url.length] === '[') return url // AsciiDoc link macro
|
|
1584
|
+
const trail = url.match(/[.,;:!?]+$/)
|
|
1585
|
+
const core = trail ? url.slice(0, -trail[0].length) : url
|
|
1586
|
+
if (core.length <= 'https://'.length) return url
|
|
1587
|
+
const placeholder = `__INLINE_CODE_${inlineCode.length}__`
|
|
1588
|
+
inlineCode.push(`\`${decodeHtmlEntities(core)}\``)
|
|
1589
|
+
return placeholder + (trail ? trail[0] : '')
|
|
1590
|
+
})
|
|
1591
|
+
|
|
1572
1592
|
// Known top-level rpk subcommands (for accurate command detection)
|
|
1573
1593
|
const rpkSubcommands = new Set([
|
|
1574
1594
|
'ai', 'check', 'cloud', 'cluster', 'connect', 'container', 'debug',
|
|
@@ -1713,6 +1733,17 @@ function formatDescription(desc, customTransformations = null, options = {}) {
|
|
|
1713
1733
|
}).join('`')
|
|
1714
1734
|
result = result.replace(/(?<!`|-)(-[a-zA-Z])(?![a-zA-Z-])/g, '`$1`')
|
|
1715
1735
|
|
|
1736
|
+
// A bare command followed by its flags ("run rpk topic list -r") is one
|
|
1737
|
+
// command, but the passes above wrap the command path and each flag
|
|
1738
|
+
// separately. Merge flag spans into the command span before them:
|
|
1739
|
+
// `rpk topic list` `-r` -> `rpk topic list -r`. The quoted form never
|
|
1740
|
+
// splits, because its whole span is protected before flags are wrapped.
|
|
1741
|
+
let merged
|
|
1742
|
+
do {
|
|
1743
|
+
merged = result
|
|
1744
|
+
result = result.replace(/`(rpk(?: [a-z][-a-z0-9]*)+(?: -{1,2}[a-zA-Z][-a-zA-Z0-9]*)*)` `(-{1,2}[a-zA-Z][-a-zA-Z0-9]*)`/g, '`$1 $2`')
|
|
1745
|
+
} while (result !== merged)
|
|
1746
|
+
|
|
1716
1747
|
// Add backticks around environment variables
|
|
1717
1748
|
result = result.replace(/(?<!`)(\$[A-Z_][A-Z0-9_]*)/g, '`$1`')
|
|
1718
1749
|
|
|
@@ -1729,12 +1760,15 @@ function formatDescription(desc, customTransformations = null, options = {}) {
|
|
|
1729
1760
|
result = result.replace(/`(\$[A-Z_][A-Z0-9_]*)`(\/(?:[^\s`]*[^\s`).,;:!?])?)/g, '`$1$2`')
|
|
1730
1761
|
|
|
1731
1762
|
// Add backticks around file paths (but not if already backticked)
|
|
1732
|
-
// Must check both the slash and the path aren't already inside backticks
|
|
1733
|
-
|
|
1734
|
-
|
|
1763
|
+
// Must check both the slash and the path aren't already inside backticks.
|
|
1764
|
+
// Like the $HOME merge above, a path may not END in sentence punctuation,
|
|
1765
|
+
// so "...in ~/.config/rpk/rpk.yaml." puts the period outside the span
|
|
1766
|
+
// instead of publishing `~/.config/rpk/rpk.yaml.`.
|
|
1767
|
+
result = result.replace(/(?<![`/])(\/(?:etc|var|usr|home|tmp)\/(?:[^\s,)`]*[^\s,)`.;:!?])?)/g, '`$1`')
|
|
1768
|
+
result = result.replace(/(?<![`/])((?:etc|var|usr|home|tmp)\/(?:[^\s,)`]*[^\s,)`.;:!?])?)/g, '`$1`')
|
|
1735
1769
|
|
|
1736
1770
|
// Add backticks around home directory paths (~/.bashrc, ~/.zshrc, ~/.config/...)
|
|
1737
|
-
result = result.replace(/(?<![`\w])(~\/\.[^\s,;:)`]
|
|
1771
|
+
result = result.replace(/(?<![`\w])(~\/\.(?:[^\s,;:)`]*[^\s,;:)`.!?])?)/g, '`$1`')
|
|
1738
1772
|
|
|
1739
1773
|
// Add backticks around common package names
|
|
1740
1774
|
result = result.replace(/(?<![`\w-])(bash-completion)(?![`\w-])/g, '`$1`')
|