Jump to content

Nvim Regex by @Rongzhou

From Wikibase
wikitext
Line 25: Line 25:
== Wikitext ==
== Wikitext ==


<syntaxhighlight ... inline></syntaxhighlight> > <code></code>:
<code><nowiki><syntaxhighlight ... inline></syntaxhighlight></nowiki></code> > <code><nowiki><code></code></nowiki></code>:


<syntaxhighlight lang="text" copy>
<syntaxhighlight lang="text" copy>
:%s#<syntaxhighlight[^>]*inline>\(.\{-}\)</syntaxhighlight>#<code>\1</code>#g
:%s#<syntaxhighlight[^>]*inline>\(.\{-}\)<\/syntaxhighlight>#<code>\1</code>#g
</syntaxhighlight>
</syntaxhighlight>

Revision as of 20:42, 29 September 2026

Markdown /md

Text <> list

:%s#^#- #
:%s#^- ##

Katex

\[ \( <> $$ $ separator change:

:%s/\(\\(\(.\{-}\)\\)\)\|\(\\\[\(\_.\{-}\)\\\]\)/\=submatch(1) != '' ? '$'.submatch(2).'$' : '$$'.submatch(4).'$$'/g
:%s/\$\$\(\_.\{-}\)\$\$\|\$\(.\{-}\)\$/\=submatch(0) =~ '^\$\$' ? '\['.submatch(1).'\]' : '\('.submatch(2).'\)'/g

Wikitext

<syntaxhighlight ... inline></syntaxhighlight> > <code></code>:

:%s#<syntaxhighlight[^>]*inline>\(.\{-}\)<\/syntaxhighlight>#<code>\1</code>#g