Skip to content

fix(docs): improve mkdocs admonition compatibility and robustness#38

Open
boboqun wants to merge 6 commits intoBinaryTape:mainfrom
boboqun:main
Open

fix(docs): improve mkdocs admonition compatibility and robustness#38
boboqun wants to merge 6 commits intoBinaryTape:mainfrom
boboqun:main

Conversation

@boboqun
Copy link
Contributor

@boboqun boboqun commented Jan 23, 2026

  • normalize admonition types to lowercase (e.g., !!! Note -> ::: note) to match VitePress custom container expectations.
  • automatically strip dangling code fences from admonition content to prevent rendering errors caused by malformed markdown (e.g., in docs/coil/compose.md).

fix(docs): enhance mkdocs admonition support for unicode and stability

  • Relax regex to \S+ to support non-ASCII admonition types (e.g., !!! 注意).
  • Add specific mapping for !!! 注意 to render as ::: note 注意.
  • Normalize standard admonition types to lowercase (e.g., !!! Note -> ::: note).
  • Automatically strip dangling code fences from admonition content to fix rendering issues in files like docs/coil/compose.md.

- normalize admonition types to lowercase (e.g., `!!! Note` -> `::: note`) to match VitePress custom container expectations.
- automatically strip dangling code fences from admonition content to prevent rendering errors caused by malformed markdown (e.g., in `docs/coil/compose.md`).

Solution:
- Replaced the fixed `height` on `.card` with `min-height` to allow cards to grow dynamically with their content.
- Added a `line-height` to `.cardTitle` to ensure multi-line titles are legible.
- Introduced media queries (`@media`) to:
  - Decrease `padding` within `.cardContent` on smaller screens.
  - Scale down `font-size` for titles and descriptions on mobile viewports for a more balanced layout.
- Relax regex to `\S+` to support non-ASCII admonition types (e.g., `!!! 注意`).
- Add specific mapping for `!!! 注意` to render as `::: note 注意`.
- Normalize standard admonition types to lowercase (e.g., `!!! Note` -> `::: note`).
- Automatically strip dangling code fences from admonition content to fix rendering issues in files like `docs/coil/compose.md`.
- Refactor `markdown-it-mk-code-tabs` plugin to generate direct `<tabs>` and `<tab>` HTML tags instead of `::: tabs` containers, aligning with the manual syntax used in other documentation files.
- Fix nested tabs support by flattening indentation of generated HTML tags, preventing `markdown-it` from parsing them as code blocks.
- Fix fenced code block rendering (e.g., `bash`) inside tabs by correctly calculating and applying output indentation relative to the parent container.
- Fix parsing of subsequent markdown blocks (e.g., `!!! note`) by ensuring a blank line is inserted after closing a `</tabs>` group.
- Enhance [Tabs.vue](cci:7://file:///Users/bobo/Documents/GitHub/Open-Docs-fork/docs/.vitepress/component/Tabs.vue:0:0-0:0) component robustness:
    - Update child filtering logic to explicitly exclude Text, Comment, and Fragment nodes, ensuring all valid tab components are rendered.
    - Add safe navigation for tab titles to prevent runtime errors.
@boboqun
Copy link
Contributor Author

boboqun commented Feb 10, 2026

feat: improve MkDocs tabs support in VitePress

  • Refactor markdown-it-mk-code-tabs plugin to generate direct <tabs> and <tab> HTML tags instead of ::: tabs containers, aligning with the manual syntax used in other documentation files.
  • Fix nested tabs support by flattening indentation of generated HTML tags, preventing markdown-it from parsing them as code blocks.
  • Fix fenced code block rendering (e.g., bash) inside tabs by correctly calculating and applying output indentation relative to the parent container.
  • Fix parsing of subsequent markdown blocks (e.g., !!! note) by ensuring a blank line is inserted after closing a </tabs> group.
  • Enhance Tabs.vue component robustness:
    • Update child filtering logic to explicitly exclude Text, Comment, and Fragment nodes, ensuring all valid tab components are rendered.
    • Add safe navigation for tab titles to prevent runtime errors.

…erated tab HTML

This fixes Vue template compilation errors when fenced code blocks inside tabs were parsed as raw text instead of HTML, due to insufficient block separation.
- Reverted changes to markdown-it-mk-code-tabs.ts and related files that caused `docs:build` to fail with "Element is missing end tag" errors.
- The documentation site now loads successfully, though some MkDocs-style `=== "Tab"` syntax remains unprocessed and does not render as tabs.
- This represents a stable state; tab processing issues are deferred for future investigation.
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