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

mkDocs -> bash docstrings to mdbook #521

Open
blaggacao opened this issue Sep 10, 2021 · 8 comments
Open

mkDocs -> bash docstrings to mdbook #521

blaggacao opened this issue Sep 10, 2021 · 8 comments
Labels
help wanted Will be solved only if someone contributes it

Comments

@blaggacao
Copy link
Contributor

blaggacao commented Sep 10, 2021

For the target use cases of makes (in large orgas / monorepos) it would be extremely useful to provide a doc generator function that generates mdbook docs from code comments.

Maybe some of the existing tooling such as nix-community/nixdoc#25 can be hijacked.

To achieve the necessary standardization and reap it's benefits, I guess, it makes sense to think this through right from the start...

@blaggacao
Copy link
Contributor Author

blaggacao commented Sep 10, 2021

A natural extension of this Idea would be a mkRundeck function that is like a manual & serialized version of a pipleline intertwined in a markdown document with apropriate emergency response instructions.

See also: https://www.rundeck.com/

@kamadorueda kamadorueda added enhancement help wanted Will be solved only if someone contributes it labels Sep 10, 2021
@blaggacao
Copy link
Contributor Author

blaggacao commented Sep 16, 2021

After my first half-way-through job implementation, I'm thinking that probably the best way to document a job is by just adding a README.md next to main.nix.

  • It will be nicely displayed in github
  • We could detect that and append it as a docs-md string to the job package
  • We could then collect those outputs and build a mdbook out of it.
  • This approach can still be combined with parsing nix code comments in any main.nix, for things like function argument documentation.

To keep in mind:

  • relative paths should be kept working between github and mdbook, that is the mdbook structure must mimick the structure within ./makes

@blaggacao
Copy link
Contributor Author

I think I'll be working on this one next, since I want to set that standard & benchmark for our repo's evolution right from the start for myself & others.

@blaggacao
Copy link
Contributor Author

This is going to be an absolute killer feature! 😄

@kamadorueda
Copy link
Contributor

The readme to the side of main.nix sounds good, however readme's are free-form which means people can write in any order and not adhere to some standards

if we want to have some order (a schema), we can use YAML.

and a schema for validating it with tools as https://ajv.js.org/ (we currently have it builtin into the framework):

Nix can process the YAML and render markdowns that then are feed into a markdown-to-html framework like https://docusaurus.io/ which make things look pretty nice:

and since everything has a schema one can do further programmatic processing to generate inverse indexes, etc:

this is the source code of the generator, it uses a lot makeTemplate:

@blaggacao
Copy link
Contributor Author

@kamadorueda You make me have an idea!

Freeform, I guess is actually an advantage. Especially for things like runbooks, etc., which require some extensive context and explanation.

However, we can bake a structured short-help into the front matter! 🚀

Best of both worlds!

@blaggacao
Copy link
Contributor Author

Re: frontmatter

Related #554

blaggacao added a commit to input-output-hk/makes that referenced this issue Sep 19, 2021
- Enable derivations to contain help as markdown
- Show help on all actions with `--help | -h` if help is set
- Show that help with `glow`

Why Markdown:

- needs to look good on github and cli
- github cli uses glow's library for `gh repo info`
- glow's library is md only
- among markup languages, md is the best known and most familiar one
blaggacao added a commit to input-output-hk/makes that referenced this issue Sep 19, 2021
- Enable derivations to contain help as markdown
- Show help on all actions with `--help | -h` if help is set
- Show that help with `glow`

Why Markdown:

- needs to look good on github and cli
- github cli uses glow's library for `gh repo info`
- glow's library is md only
- among markup languages, md is the best known and most familiar one
blaggacao added a commit to input-output-hk/makes that referenced this issue Sep 19, 2021
- Enable derivations to contain help as markdown
- Show help on all actions with `--help | -h` if help is set
- Show that help with `glow`

Why Markdown:

- needs to look good on github and cli
- github cli uses glow's library for `gh repo info`
- glow's library is md only
- among markup languages, md is the best known and most familiar one
kamadorueda pushed a commit that referenced this issue Sep 20, 2021
- Enable derivations to contain help as markdown
- Show help on all actions with `--help | -h` if help is set
- Show that help with `glow`

Why Markdown:

- needs to look good on github and cli
- github cli uses glow's library for `gh repo info`
- glow's library is md only
- among markup languages, md is the best known and most familiar one
@kamadorueda
Copy link
Contributor

It would be nice to add two jobs (linux/macos) for /tests/scriptWithHelp into .github/workflows/dev.yml so we don't break it accidentally in the future

blaggacao added a commit to input-output-hk/makes that referenced this issue Sep 21, 2021
- In case ne arguments are provided, we cannot
  access an unbound variable.

```
line 9: $1: unbound variable
```
blaggacao added a commit to input-output-hk/makes that referenced this issue Sep 21, 2021
- In case ne arguments are provided, we cannot
  access an unbound variable.

```
line 9: $1: unbound variable
```
kamadorueda pushed a commit that referenced this issue Sep 21, 2021
- In case ne arguments are provided, we cannot
  access an unbound variable.

```
line 9: $1: unbound variable
```
@kamadorueda kamadorueda moved this to 🆕 New in Makes Roadmap Sep 24, 2022
@kamadorueda kamadorueda moved this from 🆕 New to 📋 To do in Makes Roadmap Sep 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Will be solved only if someone contributes it
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants