Ok, so I have been reading about markdown here on SO and elsewhere and the steps between user-input and the db are usually given as
- convert markdown to html
- sanitize html (w/whitelist)
- insert into database
but to me it makes more sense to do the following:
- sanitize markdown (remove all tags - no exceptions)
- convert to html
- insert into database
Am I missing something? This seems to me to be pretty nearly xss-proof