Actix Markdown to HTML middleware

I'm new to rust and decided to apply everything I learned so far in a little toy project:

The goal was to create a simple actix web middleware, that transforms Markdown files to HTML while leaving every other response untouched. It relies on Actix Files to resolve files and only transforms responses, if they have the content type "text/markdown". It is based on the actix read response example.

It works and I'm happy with it, but I would like to have some feedback from seasoned rusters:

  • Is it proper idiomatic rust?
  • Are there simpler or more straight-forward solutions?
  • Could it be implemented more efficiently?
  • Are there alternatives to my ConditionalResponse enum approach? I tried to create trait objects for MessageBody, but failed due to typing issues.

nice

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.