Mathematischer Code im JupyterLab-Format$$ $$
Zu```math
In Spezifikationen konvertieren
#Skript
run.sh
filename=${1-'code.md'}
search $$
nl -ba $filename | grep "\$\\$" > TMP
num of iteration
nrow=(`wc TMP | awk '{print $1}'`)
get row number
array=($(cat TMP | awk '{print $1}'))
for i in `seq 1 ${nrow}`
do
echo ${array[$((i-1))]}
if [ $(( ${i} % 2 )) == 1 ]
then sed -ie "${array[$((i-1))]} s/\$\\$/\`\`\`math/g" $filename
else sed -ie "${array[$((i-1))]} s/\$\\$/\`\`\`/g" $filename
fi
done
rm TMP
#Anwendungsbeispiel
./run.sh code.md
Recommended Posts