83627f9931
GitOrigin-RevId: 2893f56de08021cffd9b6b6dfc70fd9ccd51eb60
14 lines
651 B
Nix
14 lines
651 B
Nix
{ runCommandNoCC, doctoc }:
|
|
runCommandNoCC "doctoc-test-generates-valid-markdown.md" { nativeBuildInputs = [ doctoc ]; } ''
|
|
cp ${./input.md} ./target.md && chmod +w ./target.md
|
|
doctoc ./target.md
|
|
|
|
# Ensure that ./target.md changed
|
|
cmp --quiet ${./input.md} ./target.md && echo "doctoc-test-generates-valid-markdown: files unchanged, test fails" && exit 1
|
|
# Check for DocToc's default title
|
|
grep --fixed-strings '**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*' target.md
|
|
# Check for at least one Markdown anchor link
|
|
grep --extended-regexp '\- \[.*\]\(#[a-z-]*\)' target.md
|
|
|
|
cp target.md $out
|
|
''
|