Open bendavis78 opened 2 years ago
After some investigation, I found the following issues:
askbot.middleware.spaceless.SpacelessMiddleware
, which strips all whitespace from the response. This is really not needed, and is destructive, as whitespace sometimes contains valuable information. The source even has a #FIXME: why do we even have this?
comment next to it. Removing this fixed the issue of newlines being stripped (you also have to modify askbot/startup_procedures.py
to avoid the startup error).<script type="text/javascript">
lanai.highlightSyntax = function(){/* noop */};
</script>
I wasn't able to find an easy solution to server-side rendering, but was able to implement it in my own fork: https://github.com/BoldIdeaInc/askbot-devel/commit/04e64226016ef6dc719bc215525ba369c2668cb6
(note: this completely replaces client-side rendering, not sure what other side effects it may have)
I don't plan on submitting a PR for that change, as I think it involves more of a design discussion.
I want the following markdown code to work:
When writing the question with the above markdown, it does not show the preview correctly:![image](https://user-images.githubusercontent.com/324392/138922097-232c761d-f99a-43cf-906f-b9e34b28f199.png)
When I submit the question, it does render correctly on the first load:![image](https://user-images.githubusercontent.com/324392/138922245-793ba69c-de4e-4c7e-916a-ae7dbac31ec7.png)
However, when I refresh the page, the code loses newlines (and the syntax colors are oddly different):![image](https://user-images.githubusercontent.com/324392/138922391-2272f01a-2b5a-46df-a255-089761b41fa9.png)