mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-24 09:01:28 +01:00
Docs link check stops hiding sections after inline code, /learn prune checks every learning, /retro counts Godot test runners (#4677)
Four small fixes from outside reports: the docs link and prose checks no longer treat a line that starts with inline code as a code block, /learn prune reads every learning instead of the first 100, /retro counts a test runner in `tests/` and skips game-engine sidecar files, and five tests that cannot work as root now skip there. Why: each one was reproduced on main and gave a wrong answer (refused valid links, skipped stale learnings, a test total of 0, red tests as root). Nothing to do after merge. Co-authored-by: Davmunrey <108531295+Davmunrey@users.noreply.github.com> Co-authored-by: huongtran84 <4927097+huongtran84@users.noreply.github.com> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
12 files changed
+118
-13
No files matched your search
+13
-3
@@ -14,12 +14,22 @@ export function githubSlug(heading: string): string {
|
||||
return heading.trim().toLowerCase().replace(/<[^>]+>/g, '').replace(/[^\p{L}\p{N}\s_-]/gu, '').replace(/\s/g, '-');
|
||||
}
|
||||
|
||||
/**
|
||||
* Lines outside fenced code blocks, as CommonMark reads fences: a backtick fence's info string has no backtick (so a
|
||||
* line opening with an inline code span such as ````x```` is text), and only a bare run of the same character, at
|
||||
* least as long as the opening one, closes the block.
|
||||
*/
|
||||
function unfenced(text: string): string[] {
|
||||
let fence: string | null = null;
|
||||
return text.split('\n').map(line => {
|
||||
const m = /^\s{0,3}(`{3,}|~{3,})/.exec(line);
|
||||
if (m) { if (!fence) { fence = m[1]![0]!; return ''; } if (m[1]![0] === fence) { fence = null; return ''; } }
|
||||
return fence ? '' : line;
|
||||
const m = /^ {0,3}(`{3,}|~{3,})(.*)$/.exec(line);
|
||||
if (!fence) {
|
||||
if (!m || (m[1]![0] === '`' && m[2]!.includes('`'))) return line;
|
||||
fence = m[1]!;
|
||||
return '';
|
||||
}
|
||||
if (m && m[1]![0] === fence[0] && m[1]!.length >= fence.length && !m[2]!.trim()) fence = null;
|
||||
return '';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -101,7 +101,9 @@ const NUMERIC_SIDE = /^[$£€]?[+-]?\d|^v\d|^CODE$|^URL$|^(?:before|after)$/i;
|
||||
const LIST_INTRODUCER = /\b(?:examples?|following|these|this|below|measurements?|two|three|four|five|six)$/i;
|
||||
const trimSide = (s: string) => s.replace(/^[(\[`"'*_]+|[)\]`"'*_,.;:]+$/g, '');
|
||||
|
||||
const FENCE_OPEN_RE = /^\s*(`{3,}|~{3,})/;
|
||||
// A backtick fence's info string has no backtick (CommonMark), so a line that opens with an inline code span such as
|
||||
// ````x```` is prose, not a fence. Indentation stays loose so a fence nested in a list item still masks its code.
|
||||
const FENCE_OPEN_RE = /^\s*(`{3,}(?=[^`]*$)|~{3,})/;
|
||||
const FENCE_CLOSE_RE = /^\s*(`{3,}|~{3,})\s*$/;
|
||||
const pad = (m: string) => ' '.repeat(m.length);
|
||||
|
||||
|
||||
Reference in new issue
Block a user