blacksmithgu / obsidian-dataview

A data index and query language over Markdown files, for https://obsidian.md/.
https://blacksmithgu.github.io/obsidian-dataview/
MIT License
7.11k stars 418 forks source link

inline code with scope qualifier (double colon) rendered incorrectly #2455

Open zhuzhidong opened 1 month ago

zhuzhidong commented 1 month ago

What happened?

What happened?

image

inline code is not rendered properly, missing scope qualifier and parentheses.

same markdown file in vscode is rendered correctly. Using exclusion method, conflict between double colon and dataview inline queries was found.

will this problem be solved in the future, or it is not a problem from plugin's view. Is there any workaround?

Here's the text.

`void* operator new(std::size_t, void*);`

DQL

No response

JS

No response

Dataview Version

0.5.67

Obsidian Version

1.6.7

OS

Windows

Rubinum commented 1 month ago

So what is your expectation how this should work? From what I understand: you try to render code within a file with the codeblock annotation but it somehow „inline code is not rendered properly, missing scope qualifier and parentheses.“

How does this relate to the dataview plugin directly? If you try to render code within codeblocks, its a core feature of obsidian, not from this plugin. You did not specify where exactly you try to render these code blocks. If it is within a query of the dataview plugin, my question would be why you need code rendered inside of a „```dataview“ block?

zhuzhidong commented 1 month ago

So what is your expectation how this should work? From what I understand: you try to render code within a file with the codeblock annotation but it somehow „inline code is not rendered properly, missing scope qualifier and parentheses.“

How does this relate to the dataview plugin directly? If you try to render code within codeblocks, its a core feature of obsidian, not from this plugin. You did not specify where exactly you try to render these code blocks. If it is within a query of the dataview plugin, my question would be why you need code rendered inside of a „```dataview“ block?

The code to be rendered is not in dataview block with three backquotes, just inline code with single backquote.

Dataview supports inline query and JavaScript inline query. Document: DQL, JS and Inlines

These two queries diff in prefix which can be customized in settings.

1

2

Dataview also supports inline fields. Document: Inline Fields

It confilicts with scope qualifier in C++ language when appeared in inline code.

sersorrel commented 2 weeks ago

IMO Dataview should not parse inline fields within code blocks. It's fine if this is interpreted as an inline field:

This will not show the (longKeyIDontNeedWhenReading:: key).

but something like this should not be:

The syntax is: `here is a (longKeyIDontNeedWhenReading:: key)`