Remove conflicting existing markdown formatting classes, overriding them #9
Labels
📋 a/task
Type: Task Effort
🤚 b/help-needed
Blocker: This ticket is too tough for me! Send help!
✨ o/feature
(Feature Requests go to Discussions/Ideas!) Objective: New feature implementation
🪞 s/cm
Scope: Codemirror
Milestone
The Problem
There are Conflicts between Obsidian-flavored Markdown vs Fountain.
For the
> Centred Text <
and> Forced Transition
Fountain token, Obsidian's standard blockquote token is still detected (since it is a>
character that starts a line) and so there are unwanted/conflicting HTML classes being applied (these beingcm-formatting-quote cm-formatting-quote-1 cm-quote cm-quote-1
as seen in the screenshot below).Then Fountain's
_Underlined Text_
and/* Boneyard */
tokens conflict with Obsidian's native_Italicised Text_
and* Leading-Asterisk Italicised Text
formatting tokens.The Solution
There are at least two ways to solve this:
Overload(?) Obsidian's native markdown formatting
This is the strategy used for this plugin so far: Obsidian-Fountain-Editor is a superset of Obsidian-flavoured Markdown, so we just add styles on top of existing markdown styles. This is good, because we don't need to reinvent inline boldface, section headings, etc. so it makes sense to continue with this
But when it comes to conflicts where we want Obsidian's regular Markdown to be suppressed (like asterisk italicising), we will have to undo those applied HTML classes.
This may be a lot of funky coding with CodeMirror (which is really complex) and may leave a problematically-HTML-structured CodeMirror document (think weird excessive nested
span
elements)Disable Obsidian's native markdown formatting
The other option is to modify the standard markdown processor to prevent triggering certain markdown styles like underscore-italicising, so that our plugin can swoop in and cleanly format underscore-wrapped-text as underlined text.
This is definitely trickier as I don't know of a way to disable core behaviour, much less disable it only for particular documents (remember, other notes should get Obsidian's native markdown formatting as normal). And they probably use some lesser-known efficient low-level parser (like Lezer) (I'm using simple regex!) that may also be locked behind closed-source.
But this definitely is the superior long-term strategy, since (1) it makes for a cleaner HTML DOM, which means cleaner CSS targeting (2) finer-tuned CodeMirror control; especially if there's an API to easily + directly style certain tokens, then that also instantly fixes #11.
Task
The text was updated successfully, but these errors were encountered: