obsidian-dataview icon indicating copy to clipboard operation
obsidian-dataview copied to clipboard

Highlighting of inline fields takes place in inline code

Open iamrecursion opened this issue 4 years ago • 1 comments

Describe the bug Writing an inline field inside backticks (for a piece of inline code) still results in inline code being highlighted in the preview view.

To Reproduce Steps to reproduce the behavior:

  1. Install and enable dataview.
  2. Type the following text
`[due:: ]`, `[created:: ]`, `[completion:: ]`
  1. Swap to preview mode.
  2. The inline fields are highlighted specially, rather than showing the raw code for them.

Expected behavior Fields inside backticks should not be highlighted specially (as happens for code blocks).

Desktop:

  • OS: macOS 12.0.1
  • Obsidian Version 0.12.19
  • Dataview Version 0.4.20

iamrecursion avatar Nov 04 '21 20:11 iamrecursion

I just ran into this same problem with Rust code like this in a code block:

`thing: Box<dyn Trait> = Box::new(Thing::new());`

I was super confused why a chunk of my code was disappeared since now my code reads thing: Box<dyn Trait> = Box::new new();. While I was messing around I also ended up with some really weird behavior having the 3 backticks on the same line as the code: I couldn't "expand" the field any more.

From my perspective it'd be nice to have Dataview ignore text inside code blocks for fields, or have a toggle to do so since :: shows up fairly frequently for me.

Edit: I originally thought I was seeing this inside multi-line code blocks, but I had some weird formatting errors that caused strange behavior. Now I'm only seeing this issue inside the inline code blocks.


OS: MacOS 14.2.1 Obsidian Version 1.5.3 Dataview Version 0.5.64

DavidPD avatar Jan 15 '24 23:01 DavidPD