I'm building a website that requires very basic markup capabilities. I can't use any 3rd party plugins, so I just need a simple way to convert markup to HTML. I might have a total of 3 tags that I'll allow.
What is the best way to convert "==Heading=="" to "< h2>Heading< / h2>", or "--bold--" to "< b> bold < /b>"? Can this be done simply with Regex, or does somebody have a simple function?
I'm writing this in C#, but examples from other languages would probably work.
thanks,
Jim
Follow up: This is such a small part of my website that I liked the simplicity of using a simple Regex replace. I made this work in C# with the following code:
string html = Regex.Replace("==This will be inside h2==", "==([^=]*)==", "< h2>$1< /h2>")
.NET uses $1 notation instead of \1 notation that might be in other languages. (Note--I added spaces in the html tags to make it display in the markdown)