I have a site where users can file game reports. I currently use a combination of markdown and HTMLPurifier to allow for limited mark-up.
I would like to add inline photo support, drawing images from a user gallery.
I've built an image sidebar with a bit of JS that on thumbnail click inserts a corresponding markdown code snippet at the cursor position.
This is all well and good, but rather than markdown processing this standard code and giving me:
<img src="foo.jpg" />
I'd much rather end up with:
<a href="original/foo.jpg">
<img src="foo.jpg" />
</a>
i.e., an automatic link to the original fullsize image.
Because the code and paths are predictable, I could change these tags at the post-markdown HTML step via string replace, but that seems... inelegant.
Should I extend or otherwise modify markdown.php to give me a customized '<img /> mark-up, or is this a bad idea for some reason I am not perceiving?
Modifying your markdown parser sounds like a good idea to me. You're entitled to getting the program you want. Be sure to store your changes as a patch as well, so you can easily re-apply them to future versions of markdown.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With