So I’m using Markdown to format text input from user:
http://michelf.com/projects/php-markdown/
But I’m doing this destructively, so the text turns into HTML before database update. Can I transform it back to markdown when displaying it on the screen? The reason is that I want to allow the user to edit that text, and need it in the original form…
Have you tried http://milianw.de/projects/markdownify/ ?
However, I should note that you should generally not store display formats in your database. It’s worth considering storing the markdown in the DB and converting it to HTML on demand.