Skip to content

Commit 0b1f819

Browse files
add lang
1 parent 7130b17 commit 0b1f819

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

scripts/make_mdx.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,15 @@ function convert_to_mdx() {
5757
for f in *.py *.sh; do
5858
if [ -f "$f" ]; then
5959
local extension="${f##*.}"
60-
awk 'BEGIN {print "```" extension}
60+
local lang=""
61+
if [ "$extension" = "py" ]; then
62+
lang="python"
63+
elif [ "$extension" = "sh" ]; then
64+
lang="bash"
65+
fi
66+
awk -v lang="$lang" 'BEGIN {print "```" lang}
6167
{print}
62-
END {print "```"}' extension="$extension" "$f" > "${f}.mdx"
68+
END {print "```"}' "$f" > "${f}.mdx"
6369
mv "${f}.mdx" "$f"
6470
else
6571
echo "No files to convert in ${CODE_DIR}"

0 commit comments

Comments
 (0)