mirror of
https://github.com/flame-engine/flame.git
synced 2025-10-30 08:27:36 +08:00
This is a proposal to extend both our text rendering pipeline and our markdown-parsing capabilities to support more fine-grained styling by leveraging a subset of the extended markdown definition of "custom attributes" (for example, see [markdown-it-attrs](https://www.npmjs.com/package/markdown-it-attrs) as an exemplary implementation). On the markdown side, the syntax will look like this: ```markdown [This is a custom class]{.my-custom-class} This word will be [red]{.red} and this one will be [blue]{.blue}. ``` Note that the current implementation only supports specifying the class name and will skip other possible permutations. On the Flame side, we add a new `customStyles` map to the `DocumentStyle` class, allowing users to provide as many styles as desired. Example:   Currently, users have to hijack the existing syntaxes for the desired styles; with the addition of code and strike-through recently I have doubled the possibilities for custom styles, but the solution still remained a hack. Also I now need more styles, and the only way forward is to support arbitrary styling. While we could consider supporting other attributes, such as id, css styling, etc, within the attribute syntax, the class name is the most flexible and versatile option, and it already solves all use cases, as class names can be used as ids (if desired) and can be used to apply the styling indirectly. I don't see any immediate advantage to supporting more complex constructs within the attributes block (though of course we can iterate as needed).