What I’m trying to do
I would like to be able to type anywhere something like:
- Entrance:
= RMB(72).
and the result be rendered as: - Entrance: 72 RMB / 8.8 €.
The conversion rate should be retrieved from a single source of truth for all the notes.
Things I have tried
I am new to Obsidian and not sure how to proceed. I have tried Inline Dataview JS but it seems I cannot call an external function. The closest so far is:
const rate = 8.2;
function RMB(x) {
return `${x} RMB / ${(x / rate).toFixed(1)} €`;
}
dv.func = dv.func ?? {};
dv.func.RMB = RMB;
dv.paragraph("Entrance: " + dv.func.RMB(72));
which obviously is not practical.