replace DataView Inline Fields in the Body by References to the new Frontmatter Fields#23
replace DataView Inline Fields in the Body by References to the new Frontmatter Fields#23Mara-Li merged 32 commits intoMara-Li:masterfrom
Conversation
… with a Link or the Value
|
Hello! It is an interesting feature. Could you please add the tests ?
if (fileName === "body_by_ref.md") {
await browser.executeObsidian(({ app }, pluginId) => {
const plugin = app.plugins.getPlugin(pluginId) as DataviewProperties;
if (plugin) {
//update the configuration here
plugin.saveSettings();
}
}, manifest.id);
} |
…switch to non-JS Expression `=this.{{prefix}}{{key}}`
|
I just got the idea that only Values should be replaced after copying them to the FrontMatter, not Expressions, because DataView evaluates only Inline Expressions. Therefore I would not replace Values that start with |
|
Well, the |
|
Hi @Mara-Li , I added a unit test pair of Files named ReplaceExpressions.md, but when running it, I don't see the results. D:\obsidian-dataview-properties>bun run e2e Execution of 2 workers started at 2026-01-06T19:17:27.733Z [0-1] Using obsidian vault: D:_Obsidian_Standards and then it stops... |
|
I have tested it on several thousand files and it looks very good now. |
|
I found something like a bug @Mara-Li : After first Generation: becomes after second Generation: The original DataView Inline-Fields in the documents were like this and I use Maybe you can guess what is the reason for this, since you are the specialist here I have added a Test File named |
to demonstrate that the DataView to Properties Operation does not remove data when .
|
Hi, I managed to solve the problem with the loss of nested Properties on re-processing a file |
|
Create a new empty vault and it should works? |
|
Also thanks for the bug fix! |
|
OK, finally the e2e Tests work. :-) |
src/main.ts
Outdated
| * Returns true for primitives, dates, durations, and simple Dataview links | ||
| * Returns false for arrays, plain objects, and other complex types | ||
| */ | ||
| private isScalarValue(value: any): boolean { |
There was a problem hiding this comment.
Unexpected any, use another type or way (maybe use unknow?)
They are probably better way to do it, probably with a library?
There was a problem hiding this comment.
Well this Method is targeted especially to Dataview scalar types which is not supported by libraries.
I'd rather keep it.
src/main.ts
Outdated
| * Normalize a value for frontmatter serialization | ||
| * Converts DateTime objects to date-only strings to avoid timezone issues | ||
| */ | ||
| private normalizeValueForFrontmatter(value: any): any { |
There was a problem hiding this comment.
Unexpected any, specify a different type
There was a problem hiding this comment.
What do you propose? It could be any of Number, Luxon.Date, string, etc.
src/main.ts
Outdated
| /** | ||
| * Interpolate template string with actual values | ||
| */ | ||
| private formatReplacement(key: string, value: any): string { |
There was a problem hiding this comment.
Unexpected any, specify a different type
There was a problem hiding this comment.
Same as above, what do you propose @Mara-Li ? the argument could be any of Number, Luxon.Date, string, etc.
Co-authored-by: Lisandra <lili.simonetti@outlook.fr>
Co-authored-by: Lisandra <lili.simonetti@outlook.fr>
Co-authored-by: Lisandra <lili.simonetti@outlook.fr>
|
If possible could you please allow edit by maintener ? I had fixed some of the issue i found. |
Sure @Mara-Li , but I thought I had already done this: |
|
Additionally I have now added you as a collaborator on my fork of this project, so you should be able to push there: |
…ies into SpocWeb/master
fields & frontmatter are considered by obsidian like `Record<string, any>`
|
@Mara-Li I tested it. This is all fine with me, what next? |
|
I will merge and publish it! Probably tomorrow. |

Hi, here is a Pull Request that implements my proposal #14 .
It adds an optional new string setting
replaceInlineFieldsWiththat, when not empty,will replace all DataView Inline Fields in the Body by References to the new Frontmatter Field.
This keeps the value in the Body in sync with the Frontmatter Value,
especially when the Frontmatter is updated, e.g. by the new
bases-Feature.This Feature can be disabled by clearing the Field, so we keep your original behavior.
I have tested it on a few dozen files and will continue to do so...