{{ $firstBracket := "\\[\\[" }}
{{ $lastBracket := "\\]\\]" }}
{{ $matrixBreak := "\\\\\\\\"}}
{{ $wikiregex := "\\[\\[([^/]+?)\\]\\]" }}
{{ $wikilinks := .Content | findRE $wikiregex }}
{{ $.Scratch.Add "content" .RawContent }}
{{ range $wikilinks }}
{{ $content := . | replaceRE $wikiregex "$1" }}
{{ $content := $content | replaceRE "\\?" "\\?" }}
{{ $wikilink := printf "%s%s%s" $firstBracket $content $lastBracket }}
{{ $anchorized := $content | anchorize }}
{{ $link := printf "%s%s%s%s%s%s" "" $content "" }}
{{ $noteContent := $.Scratch.Get "content" | replaceRE $wikilink $link }}
{{ $.Scratch.Set "content" $noteContent }}
{{ end }}
{{ $content := .Scratch.Get "content" }}
{{ $content := $content | replaceRE "\n" "\n\n" }}
{{ $content := $content | replaceRE $matrixBreak "\\\\\\\\\\\\\\\\" }}
{{ $content := $content | replaceRE "_" "\\_"}}
{{ $content := $content | replaceRE "\\{" "\\{" }}
{{ $content := $content | replaceRE "\\}" "\\}" }}
{{ $tagregexN := "#([^#\\s\\,:}]+)\\n" }}
{{ $tagregexH := "#([^#\\s\\,:}]+)#" }}
{{ $tagregexS := "#([^\\s^#][^#]*[^\\s^#])#" }}
{{ $tagregex := "[^/a-z]#([^#\\s\\,:}]+)" }}
{{ $content := $content | replaceRE $tagregexN "$1\n" | safeHTML }}
{{ $content := $content | replaceRE $tagregexS "$1" | safeHTML }}
{{ $content := $content | replaceRE $tagregexH "$1" | safeHTML }}
{{ $content := $content | replaceRE $tagregex "\n$1" | safeHTML }}
{{ $rightArrow := "" }}
{{ $leftArrow := "" }}
{{ $content := $content | replaceRE "->" $rightArrow }}
{{ $content := $content | replaceRE "<-" $leftArrow }}
{{ $content := $content | replaceRE "::([^/]+?)::" "$1" }}
{{ $content := $content | replaceRE "==([^/]+?)==" "$1" }}
{{ $content | markdownify }}