-
Notifications
You must be signed in to change notification settings - Fork 21
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
Use code snippets for code examples #32
Conversation
To ensure that examples are in sync with KUDO, their code is taken directly from the KUDO repository. The KUDO repository is added as a submodule. The [markdown-it-vuepress-code-snippet-enhanced](https://github.com/fabbballin/markdown-it-vuepress-code-snippet-enhanced) plugin is used for this, because it supports viewing only a range of lines of a snippet.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @nfnt, that's pretty neat!
Do you know if the build will fail in case a file was moved in the kudo repo? I hope it does :)
Good point to fail the build if a file is removed. Let me check this. |
The build doesn't fail if a wrong file name is included. The rendered html shows a "File not found". I'll take a look if this can get checked somehow. |
Looks like this is a limitation in Vuepress. Even regular code snippet imports only create a "File not found" message but don't fail the render. |
Created upstream issue vuejs/vuepress#1872. |
Co-Authored-By: Matthias Eichstedt <matthias.eichstedt@mesosphere.io>
This way we will get build failures in VuePress >=1.2.0 if snippet files aren't found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yarn docs:build
actually fails when sources aren't present:
error Code snippet path not found: /Users/matthias/Documents/projects/kudobuilder/www/kudo/config/samples/first-operator/operator.yaml
error Code snippet path not found: /Users/matthias/Documents/projects/kudobuilder/www/kudo/config/samples/first-operator/templates/deployment.yaml
error Code snippet path not found: /Users/matthias/Documents/projects/kudobuilder/www/kudo/config/samples/first-operator/params.yaml
Language does not exist text
wait Rendering static HTML...
wait vuepress-plugin-feed Adding pages/posts as feed items...
success vuepress-plugin-feed added 7 page(s) as feed item(s)
wait vuepress-plugin-feed Checking feeds that need to be generated...
success vuepress-plugin-feed rss2 feed file generated and saved to content/.vuepress/dist/rss.xml
success vuepress-plugin-feed atom1 feed file generated and saved to content/.vuepress/dist/feed.atom
success vuepress-plugin-feed json1 feed file generated and saved to content/.vuepress/dist/feed.json
success Generated static files in content/.vuepress/dist.
error Command failed with exit code 1.
@nfnt should we close this or is it still relevant? |
This is still relevant, but I'll have to update this to KUDO 0.8.0. There's an ongoing discussion with @meichstedt about having a workflow that does all this once new versions of KUDO are released. Because we're using the code of a tagged KUDO version, this tag needs to changed for each version bump of KUDO. I'll have to document this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for documenting the submodule approach @nfnt!
What this PR does / why we need it:
To ensure that examples are in sync with KUDO, their code is taken directly from the KUDO repository. The KUDO repository is added as a submodule. The markdown-it-vuepress-code-snippet-enhanced plugin is used for this, because it supports viewing only a range of lines of a snippet.
Which issue(s) this PR fixes:
Fixes #31
Special notes for your reviewer: