Disable markdown-breaking HTML?

So I am coming from Sublime text and I have a file that I’ve imported into Obsidian that’s over 100k words - it’s an archive of my daily work log.

Through out the log, I have copies of various code every once in a while like this, interspersed with my thoughts:

    currentAction
        <CurrentQuestion
            <QuestionRadio
                <MyButton
                    colors.button

hmm.. can we combine these?

This is all the way through the document - snippets of code, often JSX, most of which doesn’t have closing tags, and these are not inside code blocks (though some may be indented, as is the way to declare a code block in Sublime Text)

Unfortunately, an open html tag with no closing tag seems to break all Markdown that comes after it necessitating a code block to prevent it from breaking the Markdown that follows.

I would much rather have HTML treated as plaintext, or at the very least, not result in the breakage of all Markdown if a closing tag isn’t found. I only use markdown for things that I want to be emphasized / linked, so I don’t benefit from any of this markdown-disabling html behavior.

I turned off “Auto convert HTML” in the Editor panel, but that had no effect.

Any feature that currently exists to disable this? Any hack I can do to disable this?

Thanks!

Search-replacing all < and> and replacing by \< and \> may get you somewhere: it will cause these markers to be interpreted as regular characters, thus not disrupt the markdown that occurs in between.

1 Like

Indenting also marks code blocks in Markdown. It requires 4 spaces or 1 tab — is your indentation less than that?

The “Auto-convert” setting is for when you paste.

For better or worse, HTML is part of Markdown from its original conception. If you want plain text, you’ll have to change the filename extensions to something other than “.md” and install a plugin to enable viewing non-.md text files in Obsidian. But Obsidian treats only .md files as notes, and I don’t know of any of the plugins restore all the functionality (indexing, etc.) lost by changing the file type.

1 Like

Can you refer any specific community plugins? I tested Custom File Extensions plugin and it treats txt files as they were markdown. It seems there’s no way to disable rendering for txt files. One solution is to use this CSS‑snippet (that targets every file in source mode).

Couldn’t go with your solution exactly, since I didn’t want to add a bunch of clutter to all my tags, but it led me to the solution:

  • Simply search for < and everytime it turns red, replace with “” (empty string)… Was able to fix this entire huge file in under 2 minutes, making as few changes as possible. Thanks!
1 Like

Thanks, good to know the background of this issue… And as it turns out, a lot of my 4 space indented lines were doing the job, some just needed an extra spacer between them and the prior line… But ultimately had to go the route of find/replace for <.

1 Like

In most cases you should be able to replace with &lt;, and get the visual appearance of “<” without being the start of an html tag.

1 Like

I tested that you can also write \< to produce < and prevent html rendering.

\<test\>
<test>
1 Like

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