Well the first .bikemd demo code was so easy, only a few hours!
Then I started to encounter all the things that didn’t quite work. Ugh!
The problem is Bike’s data model and Markdown’s data model don’t align everywhere. Each can express things the other cannot. For Bike .bikemd the goal is a file format for Bike, it should be able to express the full Bike outline data model.
To make that work I have limited the set of supported markdown to simple ordered and unordered lists. (Bike will load other markdown, but it just scans for chunks of text and adds that to outline, doesn’t try to encode structure).
To encode Bike row and text run attributes that don’t have a corresponding Markdown syntax, Bike uses Pandoc attributes. Previously I was using embedded HTML tags, but those don’t work well recursively, where Pandoc attributes do.
Another issue that I’m running into is some attributed string patterns are just not expressible in Markdown. For example abc where ab is bold and bc is italic can’t be expressed, but being able to express those sorts of overlaps is important to support Bike’s data model. To solve this I’m trying to detect these cases, and when it’s a problem I use pandoc attributes to express the formatting instead of markdown syntax.
Here are some examples of what you might see:
// Normal markdown when possible:
**hello**
// Use pandoc attributes when not expressible in Markdown (such as for highlighting):
[hello]{mark}
// These syntaxes can be combined:
[**hello**]{mark}
// Custom attributes attached to strong:
**hello**{a=b}
// Use pandoc attributes to represent things Markdown cannot (like `abc` case)
- **a*b***[c]{em}
For rows Bike body rows are mapped to simple unordered list, but then what is Bike unodered row type mapped to? It is also mapped to markdown unordered list, but it also gets row level {type=unordered} attribute so that type is preserved when round-tripping through Markdown.
Please give the new format representation a try and let me know how it goes and what you think.
The goals are:
- Round trip Bike outline doesn’t loose data (#id support still needed)
- Readable/editable elsewhere “standard as possible” markdown
I think this really opens up some possibilities with Bike, but it’s also more limited in some ways then the original .bikemd format. No special heading treatment, the end result doesn’t look like a document, it will always be a list.
I think longer term it will make sense to have a “publish” feature that processes your carefully constructed outline into something that looks more like a published markdown document, but that’s not what this file format will be for.