-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the "Edit this page on GitHub" link in Vitepress documentation for the Mermaid Config pages #4640
Merged
Conversation
This file contains 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
We use the `unified.stringify()` function on our remark plugins to stringify the Markdown AST for our MermaidConfig documentation. However, [`.stringify()`][1] only runs the stringify phase in unified, not the "run" phase. If we want to run our plugins on the Markdown AST, we need to also use the [`.run()`][2] function. [1]: https://github.com/unifiedjs/unified#processorstringifytree-file [2]: https://github.com/unifiedjs/unified#processorruntree-file-done
Add a YAML front-matter entry called `editLink` to Markdown files in Vitepress, e.g. ```markdown --- editLink: "https://github.com/mermaid-js/mermaid/edit/develop/packages/mermaid/src/schemas/config.schema.yaml" --- Here is my markdown file! ``` Although Vitepress doesn't officially support adding a URL as a `editLink:` YAML front-matter, we can add a custom `editLink` function to our Vitepress config that does allow it.
In Vitepress, allow using a custom `editLink`, if specified in the YAML frontmatter.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #4640 +/- ##
============================================
+ Coverage 45.28% 77.01% +31.72%
============================================
Files 52 143 +91
Lines 6633 14476 +7843
Branches 18 516 +498
============================================
+ Hits 3004 11149 +8145
+ Misses 3629 3222 -407
- Partials 0 105 +105
Flags with carried forward coverage won't be shown. Click here to find out more. |
sidharthv96
approved these changes
Jul 17, 2023
Our current method of adding a entry using `+=` is not safe in YAML, since it's valid to make a YAML object entirely in JSON, see mermaid-js#4640 (comment) We're already using `js-yaml` elsewhere in this file, so we may as well use it for parsing/stringifying. Reported-by: Remco Haszing <[email protected]>
sidharthv96
approved these changes
Jul 20, 2023
github-merge-queue bot
pushed a commit
to fuxingloh/contented
that referenced
this pull request
Jul 31, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [mermaid](https://github.com/mermaid-js/mermaid) | [`10.2.4` -> `10.3.0`](https://renovatebot.com/diffs/npm/mermaid/10.2.4/10.3.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/mermaid/10.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/mermaid/10.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/mermaid/10.2.4/10.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/mermaid/10.2.4/10.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>mermaid-js/mermaid (mermaid)</summary> ### [`v10.3.0`](https://github.com/mermaid-js/mermaid/releases/tag/v10.3.0): 10.3.0 [Compare Source](https://github.com/mermaid-js/mermaid/compare/v10.2.4...v10.3.0) #### What's Changed ##### Features - Sankey diagrams by [@​nirname](https://github.com/nirname) in [mermaid-js/mermaid#4502 - Feature/1838 actor creation destruction by [@​Valentine14th](https://github.com/Valentine14th) in [mermaid-js/mermaid#4466 - Vertical branches in Git Diagram by [@​mastersibin](https://github.com/mastersibin) in [mermaid-js/mermaid#4639 - Use JSON Schema to define and document `MermaidConfig` by [@​aloisklink](https://github.com/aloisklink) in [mermaid-js/mermaid#4112 - Remove the test checking whether the JSON Schema default config matched the old default config by [@​aloisklink](https://github.com/aloisklink) in [mermaid-js/mermaid#4610 - Fixes support of the macro `ContainerQueue_Ext` for C4 diagrams definition. by [@​kislerdm](https://github.com/kislerdm) in [mermaid-js/mermaid#4577 ##### Bugfixes - Make quadrant chart options TypeScript types optional by [@​aloisklink](https://github.com/aloisklink) in [mermaid-js/mermaid#4602 - Remove double parsing by [@​nirname](https://github.com/nirname) in [mermaid-js/mermaid#4587 - Fix flowchart tooltip typing bug by [@​lishid](https://github.com/lishid) in [mermaid-js/mermaid#4562 - Bug/4590 allow notes identical to keywords by [@​ibrahimWassouf](https://github.com/ibrahimWassouf) in [mermaid-js/mermaid#4597 - feat: allow specifying on which weekday a tickInterval should start by [@​leinelissen](https://github.com/leinelissen) in [mermaid-js/mermaid#4634 - Split formatted markdown strings with unicode support. by [@​sidharthv96](https://github.com/sidharthv96) in [mermaid-js/mermaid#4470 - fix: Mind maps handles `-` signs in node ids/text by [@​knsv](https://github.com/knsv) ##### Chores - Remove all TypeScript enums and forbid them in ESLint by [@​aloisklink](https://github.com/aloisklink) in [mermaid-js/mermaid#4580 - refactor accessibility by [@​Yokozuna59](https://github.com/Yokozuna59) in [mermaid-js/mermaid#4551 - chore: Reduce codecov pushes by [@​sidharthv96](https://github.com/sidharthv96) in [mermaid-js/mermaid#4604 - Run PR-labeler-config-validator only if config changes by [@​sidharthv96](https://github.com/sidharthv96) in [mermaid-js/mermaid#4607 - chore(deps): update all minor dependencies (minor) by [@​renovate](https://github.com/renovate) in [mermaid-js/mermaid#4624 - Update all patch dependencies (patch) by [@​renovate](https://github.com/renovate) in [mermaid-js/mermaid#4566 - Update all patch dependencies (patch) by [@​renovate](https://github.com/renovate) in [mermaid-js/mermaid#4581 - Rename workflow jobs by [@​sidharthv96](https://github.com/sidharthv96) in [mermaid-js/mermaid#4574 - Removed unused code in state diagrams by [@​nirname](https://github.com/nirname) in [mermaid-js/mermaid#4631 - chore(deps): update all patch dependencies (patch) by [@​renovate](https://github.com/renovate) in [mermaid-js/mermaid#4623 - chore: remove unused `devDependency` on coveralls by [@​aloisklink](https://github.com/aloisklink) in [mermaid-js/mermaid#4641 - Allow entity diagram attribute names to start with asterisk by [@​ibrahimWassouf](https://github.com/ibrahimWassouf) in [mermaid-js/mermaid#4588 - Bug/4592 fix new line padding class diagram by [@​ibrahimWassouf](https://github.com/ibrahimWassouf) in [mermaid-js/mermaid#4633 - Fix graph not loading when the img loads too fast or fail to load by [@​pierrickouw](https://github.com/pierrickouw) in [mermaid-js/mermaid#4496 - convert `cypress/helpers/util.js` to ts by [@​Yokozuna59](https://github.com/Yokozuna59) in [mermaid-js/mermaid#4552 - build(deps-dev): bump word-wrap from 1.2.3 to 1.2.4 by [@​dependabot](https://github.com/dependabot) in [mermaid-js/mermaid#4652 - chore(deps): update all minor dependencies (minor) by [@​renovate](https://github.com/renovate) in [mermaid-js/mermaid#4663 - chore(deps): update all patch dependencies (patch) by [@​renovate](https://github.com/renovate) in [mermaid-js/mermaid#4662 ##### Documentation - Sankey: Remove duplicated examples by [@​nirname](https://github.com/nirname) in [mermaid-js/mermaid#4595 - Release docs by [@​sidharthv96](https://github.com/sidharthv96) in [mermaid-js/mermaid#4493 - Update latest news section by [@​huynhicode](https://github.com/huynhicode) in [mermaid-js/mermaid#4495 - Fix Typo by [@​ryru](https://github.com/ryru) in [mermaid-js/mermaid#4567 - Docs: add ChatGPT plugin blog post by [@​huynhicode](https://github.com/huynhicode) in [mermaid-js/mermaid#4570 - Fix relative link to theme variables list by [@​ibrahimWassouf](https://github.com/ibrahimWassouf) in [mermaid-js/mermaid#4573 - Fix docs:dev by [@​sidharthv96](https://github.com/sidharthv96) in [mermaid-js/mermaid#4598 - Docs: update link - "Join the Community" by [@​huynhicode](https://github.com/huynhicode) in [mermaid-js/mermaid#4601 - Support docs:dev in docker by [@​nirname](https://github.com/nirname) in [mermaid-js/mermaid#4599 - docs(flowchart): add documentation on multiple nodes style by [@​tomperr](https://github.com/tomperr) in [mermaid-js/mermaid#4600 - Avoid downloading avtars everytime on docs:dev by [@​sidharthv96](https://github.com/sidharthv96) in [mermaid-js/mermaid#4603 - docs: Fix checkbox syntax by [@​guilhermgonzaga](https://github.com/guilhermgonzaga) in [mermaid-js/mermaid#4646 - Fix the "Edit this page on GitHub" link in Vitepress documentation for the Mermaid Config pages by [@​aloisklink](https://github.com/aloisklink) in [mermaid-js/mermaid#4640 - Support MERMAID_RELEASE_VERSION in docs. by [@​sidharthv96](https://github.com/sidharthv96) in [mermaid-js/mermaid#4612 - Docs: update Latest News section by [@​huynhicode](https://github.com/huynhicode) in [mermaid-js/mermaid#4655 - added Typora to integrations list by [@​kgilbert78](https://github.com/kgilbert78) in [mermaid-js/mermaid#4666 - Docs: Corrects name of C4 link by [@​Incognito](https://github.com/Incognito) in [mermaid-js/mermaid#4660 - Fix a typo by [@​gjtorikian](https://github.com/gjtorikian) in [mermaid-js/mermaid#4396 #### New Contributors - [@​ryru](https://github.com/ryru) made their first contribution in [mermaid-js/mermaid#4567 - [@​ibrahimWassouf](https://github.com/ibrahimWassouf) made their first contribution in [mermaid-js/mermaid#4573 - [@​kislerdm](https://github.com/kislerdm) made their first contribution in [mermaid-js/mermaid#4577 - [@​leinelissen](https://github.com/leinelissen) made their first contribution in [mermaid-js/mermaid#4634 - [@​pierrickouw](https://github.com/pierrickouw) made their first contribution in [mermaid-js/mermaid#4496 - [@​mastersibin](https://github.com/mastersibin) made their first contribution in [mermaid-js/mermaid#4639 - [@​kgilbert78](https://github.com/kgilbert78) made their first contribution in [mermaid-js/mermaid#4666 - [@​Incognito](https://github.com/Incognito) made their first contribution in [mermaid-js/mermaid#4660 - [@​gjtorikian](https://github.com/gjtorikian) made their first contribution in [mermaid-js/mermaid#4396 **Full Changelog**: mermaid-js/mermaid@v10.2.4...v10.3.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/levaintech/contented). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMS4wIiwidXBkYXRlZEluVmVyIjoiMzYuMTEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.
📑 Summary
Fix the "Edit this page on GitHub" link for the Mermaid Config Schema http://localhost:3333/config/schema-docs/config.html.
Before (edit link points to file that doesn't exist)
Edit Link points to
packages/mermaid/src/docs/config/schema-docs/config.md
, which doesn't exist: https://github.com/mermaid-js/mermaid/edit/develop/packages/mermaid/src/docs/config/schema-docs/config.mdAfter (edit link points to correct file)
Edit Link correctly points to
packages/mermaid/src/schemas/config.schema.yaml
: https://github.com/mermaid-js/mermaid/edit/develop/packages/mermaid/src/schemas/config.schema.yaml📏 Design Decisions
Vitepress 1.0.0-beta.53 allowed the
editLink
parameter in the Vitepress config to accept a function, instead of just a pattern. I've changed this Vitepress config function to then accept a custom edit link in the YAML frontmatter of Markdown files, which is created bytransformMarkdownAst
.So essentially:
transformMarkdownAst({originalFilename, addEditLink: true})
now adds the following YAML frontmatter to a markdown file:.vitepress/config.ts
editLink.pattern
function will then use thefrontmatter.editLink
as the edit link, if it exists.📋 Tasks
Make sure you
develop
branch