forked from JackalJoe/USB-Docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
replace.sh
27 lines (23 loc) · 1.07 KB
/
replace.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# A simple cript to replace MD image tags and callout tags to HTML
# Makes docs making 85% less tedious
# Just call the script with the md file as 1st arg (./replace.sh docs.md)
# Made by Xan#7777
# MD Image Replace
sed -i -E 's|\[https://i\.imgur\.com|\![https://i\.imgur\.com|g' "$1"
sed -i -E 's|\[!\[\]\(.*\)\]\(|<p align="center"><img src="|g' "$1"
sed -i -E 's|\[!\[.*\]\(|<p align="center"><img src="|g' "$1"
sed -i -E 's|\[!\[\]\(|<p align="center"><img src="|g' "$1"
sed -i -E 's|\[!\[(.*)]\((.*)\)\]\(|<p align="center"><img src="|g' "$1"
sed -i -E 's|!\[.*\]\(|<p align="center"><img src="|g' "$1"
# png replace
sed -i 's|png)|png"><\/p>|g' "$1"
sed -i 's|PNG)|PNG"><\/p>|g' "$1"
sed -i 's|jpg)|jpg"><\/p>|g' "$1"
sed -i 's|JPG)|JPG"><\/p>|g' "$1"
# callout check
sed -i 's|<callout info>|<c><p class="callout info">|g' "$1"
sed -i 's|<callout success>|<c><p class="callout success">|g' "$1"
sed -i 's|<callout warning>|<c><p class="callout warning">|g' "$1"
sed -i 's|<callout danger>|<c><p class="callout danger">|g' "$1"
sed -i 's|<\/callout>|<\/p><\/c>|g' "$1"