# Happy Docsgiving 🦃

**URL:** https://discourse.nixos.org/t/happy-docsgiving/10214
**Category:** Announcements
**Created:** [November 26, 2020, 4:54am UTC](https://discourse.nixos.org/t/happy-docsgiving/10214 "2020-11-26T04:54:48Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![ryantm](https://discourse.nixos.org/user_avatar/discourse.nixos.org/ryantm/32/900_2.png) [@ryantm](https://discourse.nixos.org/u/ryantm)
#### Post date: [November 26, 2020, 4:54am UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/1 "2020-11-26T04:54:48Z")

</div>

Let’s give each other the gift of [CommonMark](https://commonmark.org/) this holiday season! 🦃 🎄

Since [RFC 72](https://github.com/NixOS/rfcs/blob/eee65998c1d35c06906d97b45e883a1a33504cb7/rfcs/0072-commonmark-docs.md) has been accepted, we can start converting Nixpkgs and NixOS manuals to CommonMark. The sooner we can get the old docs converted, the sooner we can reap the benefits of better output formats and easier contributions!

To get the ball rolling, I’ve started the

[CommonMark Docs project](https://github.com/NixOS/nixpkgs/projects/37)

There’s a bunch of issues in the To Do column that you can help with!

There’s also [Docbook to CommonMark Best Practices](https://github.com/NixOS/nixpkgs/issues/105243), where we’ll record what we’ve learned as we go along.

## How can I help?

1. Pick an issue in the [CommonMark Docs project](https://github.com/NixOS/nixpkgs/projects/37)
2. Follow the instructions on the issue
3. …
4. Profit from unified docs that are easier to contribute to!

## Know more about how the docs work?

Please help contribute by setting up more conversion issues and adding them to the project.

---

<div class="post-metadata">

### Author: ![jonringer](https://discourse.nixos.org/user_avatar/discourse.nixos.org/jonringer/32/1348_2.png) [@jonringer](https://discourse.nixos.org/u/jonringer)
#### Post date: [November 26, 2020, 6:34am UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/2 "2020-11-26T06:34:47Z")

</div>

Thank you @ryantm for starting to get the ball rolling.

Death to docbook, it’s 382 element types and xml structure 🙂

---

<div class="post-metadata">

### Author: ![raboof](https://discourse.nixos.org/user_avatar/discourse.nixos.org/raboof/32/1681_2.png) [@raboof](https://discourse.nixos.org/u/raboof)
#### Post date: [November 26, 2020, 8:27am UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/3 "2020-11-26T08:27:58Z")

</div>

Really great to see this moving forward.

I probably missed some of the discussion around this, but would you recommend converting each docbook file ‘by hand’, or use a tool like pandoc for an initial pass and then manually fix up the generated markdown (as I’m sure it’s inevitable to do a fair bit of manual work to make it actually right)?

---

<div class="post-metadata">

### Author: ![wil](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/w/59ef9b/32.png) [@wil](https://discourse.nixos.org/u/wil)
#### Post date: [November 26, 2020, 10:02am UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/4 "2020-11-26T10:02:52Z")

</div>

Great timing. I was looking for something small to be my first contribution to nixpkgs :).

---

<div class="post-metadata">

### Author: ![andir](https://discourse.nixos.org/user_avatar/discourse.nixos.org/andir/32/4581_2.png) [@andir](https://discourse.nixos.org/u/andir)
#### Post date: [November 26, 2020, 10:36am UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/5 "2020-11-26T10:36:46Z")

</div>

Before we start translating individual parts of the documentation: Do we have the tooling in-place to build the hybrid docs for the time being? It would be a pity to have less functional docs as outcome of this. Did the tooling discussion and integration into nixpkgs already happen somewhere?

---

<div class="post-metadata">

### Author: ![FRidh](https://discourse.nixos.org/user_avatar/discourse.nixos.org/fridh/32/7643_2.png) [@FRidh](https://discourse.nixos.org/u/FRidh)
#### Post date: [November 26, 2020, 11:34am UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/6 "2020-11-26T11:34:08Z")

</div>

Exactly, we need to agree on tooling first. This was kept out of the RFC, however the tooling and thereby extensions decides what information gets lost in the conversion. Especially when it comes to references.

---

<div class="post-metadata">

### Author: ![wil](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/w/59ef9b/32.png) [@wil](https://discourse.nixos.org/u/wil)
#### Post date: [November 26, 2020, 11:47am UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/7 "2020-11-26T11:47:35Z")

</div>

One problem raised on one of my pull requests is how to handle call outs. There doesn’t seem to be a way to handle them in markdown.

References can be handled by using {#refname} at the end of a heading (only just learnt that tonight thanks jtojnar).

---

<div class="post-metadata">

### Author: ![ryantm](https://discourse.nixos.org/user_avatar/discourse.nixos.org/ryantm/32/900_2.png) [@ryantm](https://discourse.nixos.org/u/ryantm)
#### Post date: [November 26, 2020, 2:27pm UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/8 "2020-11-26T14:27:15Z")

</div>

> [@raboof](#):
>
> I probably missed some of the discussion around this, but would you recommend converting each docbook file ‘by hand’, or use a tool like pandoc for an initial pass

Since we already support hybrid Docbook/Markdown sections (at least in the Nixpkgs manual), I don’t think it makes sense to mass convert the entire manual. That sounds too risky and too hard to split up the work.

It might be okay to pass a section through pandoc and then fix it up. I haven’t tested it.

> [@andir](#):
>
> Before we start translating individual parts of the documentation: Do we have the tooling in-place to build the hybrid docs for the time being?

The nixpkgs manual supports hybrid Docbook/Markdown sections. Looks like we’ll need to figure out what to do for NixOS.

> [@](#):
>
> Did the tooling discussion and integration into nixpkgs already happen somewhere?

No, not yet really. Based on the conversion efforts so far, we’ve run into these issues:

1. inter-section references
2. callouts
3. ShellSession code blocks let you highlight the $/# at the beginning

> [@](#):
>
> It would be a pity to have less functional docs as outcome of this.

Yes, we’ll try to do our best. As has been discussed in the RFC, it may be necessary to sacrifice some feature to reach the end goal.

---

<div class="post-metadata">

### Author: ![ryantm](https://discourse.nixos.org/user_avatar/discourse.nixos.org/ryantm/32/900_2.png) [@ryantm](https://discourse.nixos.org/u/ryantm)
#### Post date: [November 26, 2020, 10:02pm UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/9 "2020-11-26T22:02:04Z")

</div>

Yay, we had our [first successful conversion](https://github.com/NixOS/nixpkgs/pull/105007).

Thank you to wayofthepie and jtojnar.

---

<div class="post-metadata">

### Author: ![fzakaria](https://discourse.nixos.org/user_avatar/discourse.nixos.org/fzakaria/32/2643_2.png) [@fzakaria](https://discourse.nixos.org/u/fzakaria)
#### Post date: [November 27, 2020, 6:19am UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/10 "2020-11-27T06:19:09Z")

</div>

I already contributed last month the Maven language support section in markdown !

It was pretty easy and I didnt even contemplate more advanced Markdown features.

A style footer that takes you the markdown file though to edit or fix would be A+ though.

I’ve always appreciated that in projects I’ve come to love.

---

<div class="post-metadata">

### Author: ![wil](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/w/59ef9b/32.png) [@wil](https://discourse.nixos.org/u/wil)
#### Post date: [November 27, 2020, 11:22am UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/11 "2020-11-27T11:22:03Z")

</div>

I am having a bit of trouble getting inline docbook tags to work in markdown. pandoc seems to be stripping the tags out of the document.

Does anyone have an example of this working anywhere? I haven’t seen any documents in nixpkgs using it.

---

<div class="post-metadata">

### Author: ![ryantm](https://discourse.nixos.org/user_avatar/discourse.nixos.org/ryantm/32/900_2.png) [@ryantm](https://discourse.nixos.org/u/ryantm)
#### Post date: [November 27, 2020, 10:36pm UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/12 "2020-11-27T22:36:00Z")

</div>

@wil Here’s an example where an inline-docbook tag worked: [https://github.com/NixOS/nixpkgs/blame/2bb9e7c18a6b920074a4fe8bbbfab0e73b066c16/doc/languages-frameworks/beam.section.md#L84](https://github.com/NixOS/nixpkgs/blame/2bb9e7c18a6b920074a4fe8bbbfab0e73b066c16/doc/languages-frameworks/beam.section.md#L84)

---

<div class="post-metadata">

### Author: ![wil](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/w/59ef9b/32.png) [@wil](https://discourse.nixos.org/u/wil)
#### Post date: [November 28, 2020, 3:20am UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/13 "2020-11-28T03:20:10Z")

</div>

If anyone else runs into trouble with docbook tags being stripped like I did there is a work around.

You can escape any docbook code and have pandoc put it directly into the resulting document by putting it inside a code fence with this attribute on it.

````auto
```{=docbook}
Put any docbook code here
``

````

---

<div class="post-metadata">

### Author: ![ryantm](https://discourse.nixos.org/user_avatar/discourse.nixos.org/ryantm/32/900_2.png) [@ryantm](https://discourse.nixos.org/u/ryantm)
#### Post date: [November 28, 2020, 4:39pm UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/14 "2020-11-28T16:39:51Z")

</div>

I’ve made a [Meta issue for converting from Docbook to CommonMark](https://github.com/NixOS/nixpkgs/issues/105243) where we can gather up the best practices.

---

<div class="post-metadata">

### Author: ![ryantm](https://discourse.nixos.org/user_avatar/discourse.nixos.org/ryantm/32/900_2.png) [@ryantm](https://discourse.nixos.org/u/ryantm)
#### Post date: [November 28, 2020, 5:23pm UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/15 "2020-11-28T17:23:13Z")

</div>

There’s a new batch of conversion issues in the To Do column of the [CommonMark Docs](https://github.com/NixOS/nixpkgs/projects/37) project.

---

<div class="post-metadata">

### Author: ![lucasew](https://discourse.nixos.org/user_avatar/discourse.nixos.org/lucasew/32/3317_2.png) [@lucasew](https://discourse.nixos.org/u/lucasew)
#### Post date: [November 28, 2020, 7:35pm UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/16 "2020-11-28T19:35:40Z")

</div>

Just a few tips for the people that is contributing.

1. Use github codespaces if possible to edit the files. It downloads the repo (~1.3GB) way faster than your home internet. Especially if you are from Brazil.

2. To test locally you can commit in your branch at your fork and push it, you can then download the tarball of the revision that will be way smaller than the whole repo. The url seems like [https://github.com/username/nixpkgs/archive/codespaces-1.tar.gz](https://github.com/username/nixpkgs/archive/codespaces-1.tar.gz). Untar it and do the nix-build inside the docs folder to test if its nice. You can also install a extension for markdown preview in the codespaces for better feedback loop.

3. If you are a vim fan, or even a normal user, you can save time replacing common tags to the markdown equivalents like `<para>` that just go away, `<literal>` that encloses with backticks and `programlisting` that is enclosed by backticks. The hard work is to normalize the unnumbered lists, indentation, the special symbols using &something; and wrapping `<prompt>`s into three backticks (because of the special symbols).

I converted `<prompt>` blocks into three backticks but without specifying language and converted `<programlisting>` into the language its written, that is mostly Nix.

---

<div class="post-metadata">

### Author: ![fzakaria](https://discourse.nixos.org/user_avatar/discourse.nixos.org/fzakaria/32/2643_2.png) [@fzakaria](https://discourse.nixos.org/u/fzakaria)
#### Post date: [November 29, 2020, 5:41am UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/17 "2020-11-29T05:41:14Z")

</div>

@ryantm just a little nit that the documentation on nixpkgs itself are a bit different than the issue generated templates.

> **[Nixpkgs 24.05 manual | Nix & NixOS](https://nixos.org/manual/nixpkgs/unstable/#chap-contributing)**
>
> Nix is a tool that takes a unique approach to package management and system configuration. Learn how to make reproducible, declarative and reliable systems.

They mention entering `nix-shell` before doing `nix-build` and also running `make clean`

---

<div class="post-metadata">

### Author: ![fzakaria](https://discourse.nixos.org/user_avatar/discourse.nixos.org/fzakaria/32/2643_2.png) [@fzakaria](https://discourse.nixos.org/u/fzakaria)
#### Post date: [November 29, 2020, 5:51am UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/18 "2020-11-29T05:51:35Z")

</div>

For those that really want to contribute, many of them can be likely done with a _pandoc_ conversion however please **read over the generated markdown to make sure it’s good.**

Here is an example pandoc command

```bash
nix run nixpkgs.pandoc --command pandoc --from docbook \
          -s doc/builders/packages/weechat.xml \
         --to commonmark \
         -o doc/builders/packages/weechat.section.md

```

---

<div class="post-metadata">

### Author: ![ryantm](https://discourse.nixos.org/user_avatar/discourse.nixos.org/ryantm/32/900_2.png) [@ryantm](https://discourse.nixos.org/u/ryantm)
#### Post date: [December 1, 2020, 6:02am UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/19 "2020-12-01T06:02:06Z")

</div>

Update: we’ve [converted 10 sections so far](https://github.com/NixOS/nixpkgs/projects/37) and 5 more are in progress.

Special thanks to these new (since last update) conversion contributors:  
@Mic92, @fzakaria, @anon20203487, @wil

---

<div class="post-metadata">

### Author: ![ryantm](https://discourse.nixos.org/user_avatar/discourse.nixos.org/ryantm/32/900_2.png) [@ryantm](https://discourse.nixos.org/u/ryantm)
#### Post date: [December 3, 2020, 5:55am UTC](https://discourse.nixos.org/t/happy-docsgiving/10214/20 "2020-12-03T05:55:22Z")

</div>

Up to 15 conversions done; 9 in progress; and I’ve added more To Do items.

Special thanks to these new (since last update) conversion contributors:  
Stupremee, @mmlb, @lucasew

### Which sections will you convert?

Visit the [CommonMark Docs project](https://github.com/NixOS/nixpkgs/projects/37) and pick a To Do issue today.

[Next page](https://discourse.nixos.org/t/happy-docsgiving/10214.md?page=2)
