In adding entries to this lab, my list of custom component started growing. Instead of writing custom components, I thought I'd build a small markdown component, so I could write my articles in markdown, and publish them.
It's on github: @stilva/markdown, check it out.
I haven't gotten around writing any documentation, but the test within the
./src folder can serve as documentation.
There's a few performance tests I'd like to run:
- What are the performance implications in creating DOM elements vs building string representations and using
- Same for using createElement as a building block (I'm not convinced there's much to gain by converting the input as actual react components, given the static nature of markdowns)
- Avoiding regexp, and having a more abstract representation of the markdown. e.g. new Node(), new Leaf()
I initially had decided to use RegExp to keep the code simple, and to worry about performance when needed. The only performance optimisation I have done this far, is to cache the rendered HTML string in the SessionStorage. At the moment the only way to invalidate it is by passing a new key.