Skip to content

fix(web): strip OKF frontmatter from note body; colour graph by type#145

Merged
CryptoJones merged 1 commit into
mainfrom
fix/web-frontmatter-and-graph-type
Jul 2, 2026
Merged

fix(web): strip OKF frontmatter from note body; colour graph by type#145
CryptoJones merged 1 commit into
mainfrom
fix/web-frontmatter-and-graph-type

Conversation

@CryptoJones

Copy link
Copy Markdown
Owner

Summary

Two follow-ups to the 3.8.0 OKF work, both in the server's web UI + graph — the "did you update the graph thinggy?" gaps.

Fixed — frontmatter showed as body text (regression from 3.8.0)

The note view rendered the body with marked.parse(data.raw). After 3.8.0 gave every note a leading --- YAML frontmatter block, marked rendered it as a horizontal rule + the frontmatter keys as stray text atop every note. renderMarkdown now strips the leading frontmatter block first (it's already in the structured header). Client-side only, so no Python test caught it — verified with node.

Changed — graph coloured by OKF type

The knowledge graph (web view + omind graph export) now colours nodes by their OKF type, with a legend built from the types present. Node size still encodes link degree.

  • graph.py: GraphNode carries okf_type (derived the same way render_fields does); to_json emits a type per node (so /api/graph and graph export --json carry it); to_dot fills nodes by type.
  • graph.js: type->colour map + type legend, replacing the degree-tier colouring.

Verification

  • ruff + mypy clean; full pytest 742 passed (+3 graph tests: type carried into nodes / JSON / DOT)
  • JS: node --check on both files; frontmatter-strip regex node-tested (strips frontmatter, preserves a later --- hr in the body)

Note: the checked-in docs/graph.png still shows the old colouring — the DOT export is type-coloured now, so regenerating it picks up the new scheme.

🤖 Generated with Claude Code

Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/

…by type

Two follow-ups to the 3.8.0 OKF work, in the server's web UI + graph:

Fixed — the note view ran `marked` over the raw note, so 3.8.0's new leading
`---` frontmatter block rendered as a horizontal rule + the frontmatter keys as
stray text atop every note. `renderMarkdown` now strips the leading frontmatter
block before rendering (it's already surfaced in the structured header). No Python
test caught this — it's pure client-side rendering — so verified with node.

Changed — the knowledge graph now colours nodes by OKF `type` instead of by
degree (node SIZE still encodes degree), with a legend built from the types
present. graph.py: GraphNode carries `okf_type` (derived the same way render does),
`to_json` emits a `type` per node (so /api/graph + `graph export --json` carry it),
and `to_dot` fills nodes by type. graph.js: type→colour map + type legend.

ruff + mypy clean; full suite 742 passed (+3 graph tests). JS syntax-checked with
`node --check`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JFuGddPx3UhUkcC74KBXZB
CryptoJones added a commit that referenced this pull request Jul 2, 2026
Web UI + graph follow-ups to the 3.8.0 OKF work (#145): strip the OKF frontmatter
from the rendered note body (it was showing as an <hr> + keys after 3.8.0), and
colour the knowledge graph by OKF `type` (node size still encodes degree).

Version 3.8.0 -> 3.8.1 (pyproject + __init__ + uv.lock); CHANGELOG. Patch: a
regression fix plus a change to existing graph colouring. ruff + mypy clean; 742
passed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JFuGddPx3UhUkcC74KBXZB
@CryptoJones CryptoJones merged commit 9afde65 into main Jul 2, 2026
12 of 14 checks passed
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.

1 participant