Skip to content

Enhance metro route diagram with line colors and styling fixes - #25

Merged
xinshoutw merged 4 commits into
mainfrom
dev
Sep 4, 2026
Merged

xinshoutw merged 4 commits into
mainfrom
dev

Conversation

@xinshoutw

Copy link
Copy Markdown
Collaborator

This pull request improves the rendering and theming of Taipei MRT line diagrams in the documentation, ensuring consistent use of line colors, better mobile handling, and clearer visual distinction of terminal stations. It introduces a system to automatically color metro lines in Mermaid diagrams based on their names, updates the relevant CSS and JavaScript, and clarifies usage instructions in the documentation.

Metro diagram theming and rendering improvements:

  • Added MRT line color variables to tokens.css, ensuring each line's color matches the site's palette and meets accessibility standards. (src/styles/tokens.css)
  • Implemented automatic MRT line coloring in Mermaid diagrams by mapping edge labels (line names) to CSS variables and applying these colors dynamically after Mermaid renders the SVG. (src/scripts/content.ts)
  • Enhanced Mermaid diagram CSS for improved appearance, including better node styling, terminal station highlighting, and consistent edge label formatting. (src/scripts/content.ts)
  • Improved mobile and overflow handling for Mermaid diagrams, ensuring diagrams remain readable and scrollable on small screens. Added pre-render placeholders and error fallback for failed renders. (src/styles/markdown.css)

Documentation and usage clarification:

  • Updated the MRT diagram usage notes in SPEC.md to specify that line colors are always applied via tokens in content.ts, and established conventions for labeling lines and marking terminal stations. (docs/spec/SPEC.md)
  • Clarified route directions and updated the Mermaid diagram in the transportation article to use new conventions and highlight the terminal station. (src/content/articles/transportation.md) [1] [2]

aionyx02 and others added 4 commits September 1, 2026 09:37
- an edge label naming a Taipei metro line paints that segment and its label in the line's color
- add the --mrt-* tokens; blue, green, orange and brown reuse the category colors, red is calibrated to the same lightness
- move diagram styling into themeCSS: paper stations, rounded corners, line-strong outlines and markers
- mark the destination station with class dest, drawn as a solid ink pill
- reserve the block height before mermaid renders so the source no longer flashes
- center wide diagrams with an auto margin; justify-content clipped the left edge out of scroll reach
- name the platform direction in the transfer tabs
- record both diagram conventions in the syntax spec
- the placeholder hid the block until mermaid set data-processed, so a failed import or render left an empty box behind
- flag the blocks mermaid never processed and let their source through again
feat(Mermaid): color the metro route diagram by line
@xinshoutw xinshoutw self-assigned this Sep 4, 2026
@xinshoutw xinshoutw added the enhancement New feature or request label Sep 4, 2026
@xinshoutw
xinshoutw merged commit 716328d into main Sep 4, 2026
3 checks passed
@greptile-apps

greptile-apps Bot commented Sep 4, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds token-based Taipei MRT line colors and applies them to Mermaid edges after client-side rendering, while improving terminal-node styling and failure/mobile presentation.

  • Adds shared MRT palette tokens and Mermaid theme rules.
  • Maps labeled MRT edges to their corresponding line colors.
  • Preserves readable source when Mermaid rendering fails.
  • Updates the transportation diagram and documents its authoring conventions.

Confidence Score: 5/5

The PR appears safe to merge with no concrete blocking or independently actionable issues identified.

The rendering, styling, fallback, documentation, and article changes remain aligned, and the investigated Mermaid integration concerns did not establish a reachable observable failure.

Important Files Changed

Filename Overview
src/scripts/content.ts Adds Mermaid theme configuration, MRT label-to-token mapping, post-render edge coloring, and render-failure fallback behavior.
src/styles/markdown.css Improves Mermaid overflow behavior, establishes a mobile minimum width, and hides source only while client rendering is pending.
src/styles/tokens.css Adds centralized color tokens for the six documented Taipei MRT lines.
src/content/articles/transportation.md Clarifies train directions and updates the route diagram to use shaped nodes and destination styling.
docs/spec/SPEC.md Documents the MRT edge-label convention and destination-node class used by the rendering enhancement.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Markdown Mermaid diagram] --> B[Client-side Mermaid rendering]
  B --> C[Rendered inline SVG]
  C --> D[Match edge labels to MRT tokens]
  D --> E[Apply route colors and terminal styling]
  B -->|Rendering fails| F[Expose readable Mermaid source]
Loading

Reviews (1): Last reviewed commit: "Merge pull request #24 from NTUST-OpenSo..." | Re-trigger Greptile

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants