Apostrophe seems to turn rest of line yellow

Things I have tried

Seems to happen when using an apostrophe - can’t do this makes “t do this” yellow

What I’m trying to do

Would like this not to happen

My first thoughts are:

  • Is it the CSS theme?
  • Is the developer tab open?
  • Have you tried restarting Obsidian?

Rstarted - Still there.
Did not know there was a developer tab.
Not using CSS other than default.

Hmm, not heard of that before.

Does it happen when you open up a different vault, remove the vault config folder and re-open that folder?

Can you post a screenshot of it happening? Maybe there is a problem someone can see.

Otherwise, can you run the command “Show debug info” and paste the results here?

After playing with it. Realized it was only happening in one file.

Turns out if you create a YAML block at the top of a file and you put a single space after the bottom “—” then this yellow appostrophe effect occurs.

1 Like

Should I post this is a parser bug? given that it’s a space after the bottom of yaml causing the issue.

Do you mean the space is on the same line, ---_ where the underscore is your space?

No, that isn’t a bug. That’s a syntax error. When you’re typing syntax, you just have to watch out for typos.

So.

---
something: value
something else :value
---_ ← space here rather than ---CR

causes every line in the markdown file with an apostrophe in it to make everything in the line after the apostrophe yellow.

Every line that can’t see OMG EVERYTHING ON THE REST OF THIS LINE IS YELLOW
TYPING MORE THINGS won’t OMG EVERYTHING ON THE REST OF THE LINE IS YELLOW

That means that a parser error is triggering styling behavior. Likely the same parser that changes text and font in the editor for things like * or _. This would be behavior that is not expected - hence a BUG in the software.

--- is not the same as --- . And it has to be --- to close the YAML block.

It just has to be exact to close the block. It’s a typo.

It isn’t just “making everything yellow after the apostrophe.” Your whole document will still think it is inside the YAML block, so it’s formatting more like code.

1 Like

Sure. Thank you for calrifying. Below is the reasoning about why this should be viewed as Bug and fixed. What is the use case for which this behavior is acceptable?

Are there other ways to close a YAML block? Is there a use case where --- are used within a YAML block and not to close it?

Any reason other than Obsidian convention that there can not be multiple YAML blocks in a page?

This is a known behavior of the way the parser (tree sitter) results are being interpreted by the syntax highlter. The question is whether this behavior should be the behavior. There seems like no good reason why this behavior is useful or desired.

BTW what is the parser being used? Do we know more about this component in the build? Is it something custom or is it an Electron App Component?

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