Skip to content

Workspace: Markdown files as a page; the visualizer shows the file that ran - #55

Merged
cedricvogel-leo merged 2 commits into
mainfrom
feature/markdown-view
Nov 6, 2026
Merged

cedricvogel-leo merged 2 commits into
mainfrom
feature/markdown-view

Conversation

@cedricvogel-leo

@cedricvogel-leo cedricvogel-leo commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

For P45 (instructions as a tab in an IDE project): the editor part. The IDE part is glpython-edu.github.io#39 (it installs this branch until a tag exists).

1. Markdown as a page (renderMarkdown)

A new optional workspace prop, renderMarkdown?: (source: string) => string. It is the host's renderer, and it must return sanitized HTML. The IDE passes marked + DOMPurify; the embed passes nothing and is unchanged.

With the prop, a .md tab gets a switch at the end of the tabs: Ansicht / Text (en: View / Text).

  • Default view: a read-only file opens as the page, an editable one as its text. The choice is remembered per file while the workspace lives.
  • Page: it lies over the editor. The editor stays mounted below it (so its state and the one-model rule are untouched) and is inert meanwhile, so Tab doesn't reach it. The page itself takes the focus and scrolls.
  • Styling uses the --glp-* tokens: headings, lists, links in the info colour, inline code and code blocks in the code font on the surface colour, tables that scroll sideways, quotes, images capped at the width, and narrower padding below 700 px.
  • Strings: markdownViewLabel, markdownPage and markdownText, optional and in both languages.

2. Fix: «Visualisieren» with another tab open

The visualizer drew its root frame for the open tab (activeFile), while the trace is of mainFile. With a helper, a library or a Markdown file open, the view was empty. Now it draws the main file (or a visualized REPL input), as the → chain already did. The IDE's new browser check found this: «Visualisieren» with aufgabe.md open.

Checks

Lint (the known warning only), build and test:protocol pass locally. The behaviour is checked in the IDE's test:browser (the PR there), since only the IDE passes renderMarkdown.

Going live

The embed doesn't pass renderMarkdown, so for it only the visualizer fix applies (the embed has one file open anyway). The IDE needs this tag and its own PR.

🤖 Generated with Claude Code

cedricvogel-leo and others added 2 commits November 6, 2026 17:06
… / Text»

With the new prop renderMarkdown (the host's renderer, returning
sanitized HTML), a .md tab has a switch at the end of the tabs: a
read-only file opens as the page, an editable one as its text. The page
lies over the editor, which stays mounted (inert meanwhile). Styles in
the tokens: headings, lists, code in the code font, tables, quotes.
Without the prop, nothing changes (the embed doesn't pass it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The module frame was drawn for the open tab (activeFile), while the
trace is of the main file: with another tab open (a helper, a library,
a Markdown file), «Visualisieren» showed an empty view. Now it shows the
main file (or a visualized REPL input), as the → chain already did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cedricvogel-leo
cedricvogel-leo merged commit 97ad352 into main Nov 6, 2026
1 check 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