Skip to content

Commit 9e60fde

Browse files
committed
admonition transform
1 parent eee65a2 commit 9e60fde

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

driver-ci

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,29 @@ TUTORIAL_DST="$DOCS_SOURCE_DIR/tutorial.md"
3838
done < "$TUTORIAL_SRC"
3939
} > "$TUTORIAL_DST"
4040

41-
# === Copy and transform README.md into index.md ===
41+
# === Copy and transform README.md into index.md (with admonition fix) ===
4242
README_SRC="$TMP_DIR/amago-crr_k/README.md"
4343
INDEX_DST="$DOCS_SOURCE_DIR/index.md"
4444

4545
{
4646
found_title=false
4747
while IFS= read -r line; do
48+
# Rewrite title to "# Home"
4849
if ! $found_title && [[ "$line" =~ ^# ]]; then
4950
echo "# Home"
5051
found_title=true
52+
continue
53+
fi
54+
55+
# Replace GitHub-style admonitions with MyST blocks
56+
if [[ "$line" =~ ^\[!TIP\] ]]; then
57+
echo '```{tip}'
58+
echo "${line/\[!TIP\]/}" | sed 's/^ *\*NOTE*[:]* *//'
59+
echo '```'
60+
elif [[ "$line" =~ ^\[!WARNING\] ]]; then
61+
echo '```{warning}'
62+
echo "${line/\[!WARNING\]/}" | sed 's/^ *//'
63+
echo '```'
5164
else
5265
echo "$line"
5366
fi

0 commit comments

Comments
 (0)