Skip to content

Latest commit

 

History

History
26 lines (16 loc) · 502 Bytes

hugo-migration.md

File metadata and controls

26 lines (16 loc) · 502 Bytes

Useful sed tester - https://sed.js.org#

Find all image links

ag -c '!\['

Convert image links (with quoted titles)

sed -i -r 's/!\[(.*)\]\((.*) "(.*)"\)/{{< screenshot "\2" >}}\3{{< \/screenshot >}}/g' file.md

Convert document links to short codes

[title](../path/other.md#anchor "title") => [title]({{< relref "../path/other.md#anchor" >}})
sed -i --regexp-extended 's/\]\(([^)]+\.md(#[^")]+)?)( "[^"]+")?\)/]({{< relref "\1" >}})/g' file.md