Ebonsignori / obsidian-timeline-schedule

Inline timelines generated from human-readable time strings, e.g. 'Walk dog (30min)' in a ```schedule codeblock.
MIT License
14 stars 0 forks source link

[Bug] Data loss if placed in a callout #1

Closed leah-ferguson closed 10 months ago

leah-ferguson commented 1 year ago

If the schedule code block gets placed in a callout, the schedule gets wiped.

> [!info] Schedule
> ```schedule
> [Start]: 07:00 AM
> [7:00 AM]: Brew coffee (10 min)
> [7:10 AM]: Drink coffee in bed and read because it's Saturday (1h 50 min)
> [9:00 AM]: 
> [Finish]: 09:00 AM
> ```

becomes this after modifying the note outside of the code block (any key):

> [!date] Schedule
> ```schedule
[Start]: 07:29 AM
[7:29 AM]: 
[7:29 AM]: 
[7:29 AM]: 
[7:29 AM]: 
[Finish]: 07:29 AM

The time updates to the user's current time.

Ebonsignori commented 1 year ago

Good find @leah-ferguson! Thank you for opening an issue.

Fixed in https://github.com/Ebonsignori/obsidian-timeline-schedule/releases/tag/1.1.0 so callouts stop any auto-complete functionality.

I'm not sure if this solves your use case though.

For instance, with the new behavior anything you try to change inside a ```schedule codeblock that is nested in a callout won't be updated.

e.g.

> ```schedule
> [Start]: 07:00 AM
> [7:00 AM]: Brew coffee (10 min)
> [7:10 AM]: Drink coffee in bed and read because it's Saturday (1h 50 min)
> [9:00 AM]: 
> [Finish]: 09:00 AM
> ```

I think this is expected behavior since (as far as I was able to test) codeblocks in callouts aren't parsed as codeblocks in Obsidian, but plaintext.

This is also consistent with how my understanding of callouts work. You're typically using them to quote and so won't be changing the values inside once quoted?

If this is the case I'll close this.

If you think autofill functionality should extend to codeblocks in callouts let me know and I'll see what I can do.

leah-ferguson commented 1 year ago

I use codeblocks regularly in callouts, but for mainly Dataview queries and mermaidjs. I'm not a dev, but I suspect the difference may be that those codeblocks aren't actively modified by the plugin.

It would be great functionality to have if it's not a lot of trouble, as I've seen many users use codeblocks to style their notes. If not, it may be worth including it in your readme that they aren't intended work in codeblocks.

Ebonsignori commented 10 months ago

Late to this, but added support for callouts when using the pretty-preview option. Auto complete works in callouts, but can be finicky and isn't recommended. Added this to README.

Thank you for the helpful feedback!

Hopefully it will soon be published