Is it possible to add custom markdown syntax?

I already know we can perform text alignment through html tags, but it is impossible to use markdown syntax within an html tag, so if I wanted to bold/italicize text inside a centered block, I’d need html, not markdown. I’ve seen threads where people are suggesting changing the css for paragraphs to (for example) justify instead of left (assuming that’s what the user wants), and also cases where changing the css for block quotes to display centered instead of left.

While I understand the ‘>’ syntax for block quotes exists natively in md, so all we are doing is changing how the block quote is displayed, I was also curious if extra functionality could be added through css, particularly text alignment. Personally, it feels strange to see native text alignment for tables being supported but not in general md as a whole.

Syntax example:
<<This sentence being surrounded by double left arrows is left aligned.<<
>>This sentence is right aligned.>>
>>This sentence is center aligned.<<
<<This sentence is justified.>>

I understand this isn’t full-proof since I had to add the escape \ key to prevent accidental block quotes and html tags.


But I think that issue can be circumvented by making sure there is a space after the symbols to make sure text is being treated a certain way. For example:
> > This is treated as a nested block quote whereas >>This is treated as a right aligned text.>>
Considering such a thing is already implemented for italics (*This is italicized* but * this is not *), it wouldn’t be too farfetched to think it can be done relatively easily, right?

I’m putting this thread in ‘Help’ category for now, but if the community says so, I can change it to feature request or plugin ideas.

For CSS to me able to kick into action there needs to be some html element to change the appearance of. A block quote is such an element, and can thusly be altered. Most markdown elements gets translated to html element before presentation.

In some strange/seldom cases the markdown text/markup there are also some javascript behind the scenes doing some magic, like how tasks are linked to their origin.

What I’m trying to say is that one or another you need some element to attach the CSS to, and in most cases those elements are either added by the engines running Obsidian, or by a plugin extending the markup language.

So if I’m understanding this right, markdown syntax gets translated to html by obsidian and then displayed based on the predefined css? And one way to add such functionality would be to have a plugin that reads the extended syntax and translated them to a different html tag, correct?

That seems to be correct, with the exception that the html is presented first to the “browser” before the CSS is applied. This is a little nitpicking on semantics though.

I see. So, um… how do I move this thread to the ‘Plugin ideas’ category? :sweat_smile: I don’t see an edit button for the main post.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.