eshaanjoshi / readme

1 stars 1 forks source link

Refactor to not needing to preprocess post body every page load #7

Open wade-cheng opened 2 months ago

wade-cheng commented 2 months ago

As far as I can tell, every time a post is loaded (see urls.py), it's ran through the markdown parser twice. Once in the view itself, and then once it's passed to the template, it's ran though the filter create_md which does the same thing (see tag.py).

This happens in both detail.html and index.html.

In theory removing the parser code from the view is fine.

But it would also be helpful to cache this (ie save the converted-to html in the database) every time a change is made and just pass that cached data through the view instead.

wade-cheng commented 2 months ago

idk caching also sounds like premature optimization lmao md conversion is really fast i bet

eshaanjoshi commented 2 months ago

my reasoning for the additional preprocessing is to simplify the editing side for changing the article, instead of having html littered everywhere. Any thoughts?