Preview does not accurately represent published state
The markdown previewer does not always represent what winds up being published. Have seen issues with smart quotes or in the case of embedded video (issue #492 ) we can wind up with a page that doesn't publish with errors not visible on the previewer, or stripped out content per this example
Thanks for bringing this up Thom! I was thinking about this recently. The problem comes from the fact that we use two different libraries to turn markdown into html -- one in javascript for the preview and the other one in elixir -- the one that actually publishes this.
My guess here:
- The original version of constable probably used the same JS renderer for both preview and show views
- At some point when we refactored/simplified things it became two separate renderers
It is now in fact true that we are using slightly different rendering rules for the preview vs the show view, and I wouldn't be surprised if the preview is "more liberal" (strips less out) than the show view.
Other than "do a once over on both renderers and try to make them closer" or "make the preview step require a form submit and use the elixir renderer instead of JS", I'm not sure what else to try.
Something I've wanted to try that would fix this is to use Phoenix LiveView to handle the preview. We'd essentially be doing the same thing this example of Phoenix Live View is doing -> http://markdown.dichev.io/
This also seems to effect strike-through (which is very important for bad jokes in Constable posts).
When previewing an announcement, ~single tildes~ render as strike-through. After an announcement has been published, ~~double tildes~~ are needed.