Skip to content

Add auto-refresh and current mode#2

Open
nbox wants to merge 6 commits intoparente:mainfrom
nbox:feature/auto-refresh
Open

Add auto-refresh and current mode#2
nbox wants to merge 6 commits intoparente:mainfrom
nbox:feature/auto-refresh

Conversation

@nbox
Copy link

@nbox nbox commented Jan 24, 2026

Description

  • Added optional auto‑refresh (focus + interval) with pause while editing to avoid conflicts.
  • Added mode: current with current conditions, optional next‑hours line, and a compact inline graph.
  • Showed a clear offline message in current mode instead of stale data.
  • Made date: now/today respect tz when provided.
  • Updated README with new usage examples, parameters, and screenshot.

Usage examples

```etch-weather{date: now}
```
```etch-weather{mode: current, next: true, graph: true, hours: 12}
```
plugin-demo-mode-current

Testing

  • npm run lint
  • npm run svelte-check

@nbox
Copy link
Author

nbox commented Jan 29, 2026

I also added support for graph-pp, which adds precipitation-probability bars with numeric labels.

```etch-weather{mode: current, next: true, graph: true, graph-pp: true, hours: 12}
```
plugin-demo-mode-current-precipitation

@parente
Copy link
Owner

parente commented Jan 30, 2026

@nbox Thanks for submitting this PR. On my radar to have a look and review it. Just haven't had much time this week.

@parente parente requested review from Copilot and parente and removed request for Copilot January 30, 2026 20:39
Copy link
Owner

@parente parente left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nbox Thank you for taking the time to work on this. Clearly a labor of love.

I had been thinking about richer rendering of the text data when the plug-in is active and installed so I'm glad to see you take it in that direction. I particularly like the idea of the source block content still being human readable and useful even when the Markdown is viewed elsewhere or the plug-in is uninstalled.

I left a few questions / comments in line. I think the graph rendering is the only true blocker.

setting
.setName("Enable auto refresh")
.setDesc(
"Automatically update blocks with `date: now`, `mode: current`, or `autoRefresh: true`."
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double-checking: This setting will turn on/off auto-refresh even for blocks that are marked autoRefresh: true? (👍 from me if so: global on/off switch)

(hour) =>
`${hour.time.format("HH:mm")} ${hour.temperature.toFixed(0)}${hour.temperatureUnit} ${hour.precipitationProbability.toFixed(0)}${hour.precipitationProbabilityUnit}`
);
lines.push(`Next ${count}h ${parts.join(" • ")}`);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: Worth making this info easier to read when in the raw markdown (outside obsidian, when the plug-in is uninstalled?) Minimally, should the first data point align with the wind value one line up?

Image

{#if currentMode === "current" && showGraph && !isOffline}
{@const graphData = buildGraphData(nextHours, hourCount, showPrecip)}
{#if graphData}
<div class="graph">
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Rendering in the default Obsidian dark & light mode themes in a fresh vault on macOS uses all black for chart colors. Are you using a custom theme in the screenshots you took? Some other factor at play?

Image Image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, that does sound like a theme/CSS-variable interaction. I’ll try to reproduce it soon on macOS in a fresh vault and test across the default light/dark themes (and a couple popular ones), then adjust the styling/colors so the chart stays readable everywhere. Thanks for catching this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants