Code mathématique au format JupyterLab$$ $$
À```math
Conversion aux spécifications
#scénario
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
#Exemple d'utilisation
./run.sh code.md
Recommended Posts