fix(docs): improve mkdocs admonition compatibility and robustness#38
Open
boboqun wants to merge 6 commits intoBinaryTape:mainfrom
Open
fix(docs): improve mkdocs admonition compatibility and robustness#38boboqun wants to merge 6 commits intoBinaryTape:mainfrom
boboqun wants to merge 6 commits intoBinaryTape:mainfrom
Conversation
- 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.
Contributor
Author
|
feat: improve MkDocs tabs support in VitePress
|
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
!!! Note->::: note) to match VitePress custom container expectations.docs/coil/compose.md).fix(docs): enhance mkdocs admonition support for unicode and stability
\S+to support non-ASCII admonition types (e.g.,!!! 注意).!!! 注意to render as::: note 注意.!!! Note->::: note).docs/coil/compose.md.