Skip to content
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

Merged
merged 11 commits into from
Dec 5, 2019
Merged

Conversation

nfnt
Copy link
Member

@nfnt nfnt commented Sep 16, 2019

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:

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.
@nfnt nfnt added the WIP label Sep 16, 2019
@nfnt nfnt requested a review from gerred as a code owner September 16, 2019 13:04
@nfnt nfnt requested review from alenkacz and meichstedt September 16, 2019 13:05
@nfnt
Copy link
Member Author

nfnt commented Sep 16, 2019

WIP, need to double-check that I'm getting the submodule stuff right.

@nfnt nfnt self-assigned this Sep 16, 2019
@nfnt nfnt removed the WIP label Sep 16, 2019
Copy link
Contributor

@meichstedt meichstedt left a 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 :)

@nfnt
Copy link
Member Author

nfnt commented Sep 16, 2019

Good point to fail the build if a file is removed. Let me check this.

@nfnt
Copy link
Member Author

nfnt commented Sep 16, 2019

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.

@nfnt
Copy link
Member Author

nfnt commented Sep 17, 2019

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.

@nfnt
Copy link
Member Author

nfnt commented Sep 20, 2019

Created upstream issue vuejs/vuepress#1872.

Co-Authored-By: Matthias Eichstedt <matthias.eichstedt@mesosphere.io>
@nfnt nfnt requested a review from meichstedt October 22, 2019 13:51
Copy link
Contributor

@meichstedt meichstedt left a 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.

@alenkacz
Copy link
Contributor

@nfnt should we close this or is it still relevant?

@nfnt
Copy link
Member Author

nfnt commented Nov 20, 2019

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.

Copy link
Contributor

@meichstedt meichstedt left a 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!

@meichstedt meichstedt merged commit d127fe6 into master Dec 5, 2019
@meichstedt meichstedt deleted the nfnt/import-code-snippets branch December 5, 2019 15:19
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.

Link code snippets from existing examples in KUDO
4 participants