Creating a useful and funny python serializer

Hello markpickle

I got the name from ChatGPT.

Origin Story

I wanted an API to support as many mime types as possible. Some mime types are for the people, such as PDF, Excel/CSV. Some time types are for the machines, like json, bson.

I thought, what about HTML and text? HTML has a problem with XSS risks. Text has a problem of not having much of a standard story for "styled" plaintext. Except for Markdown. Can I use markdown as a mime type for what starts out as a JSON object?

Challenges

The app is two functions, loads and dumps and they take or return an Any type and take or return a string. The Any is a problem, because mypy doesn't know how to deal with arbitrarily complex types. It seems to get confused with Unions of Unions of Unions. It gets confused with generics, e.g. lists that can work with any contents.

Impedance Mismatches

Markdown has some analogies:

Some things are impossible

Python has no use for a lot of markdown formatting, such as bold, or code block or quote. Those things would just be strings and they'd continue to hold markdown in the string.