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

NixOS docs: making it easier to hack on #39649

Merged
merged 4 commits into from Apr 30, 2018
Merged

Conversation

grahamc
Copy link
Member

@grahamc grahamc commented Apr 28, 2018

Motivation for this change

Make the docs easier to hack on with normal editors

Commits:

  1. make a single build provide all the automatically generated XML you need to build with normal tools
  2. create a makefile for debugging with xmloscopy, and made options-db.xml validate (this required adding a parent element, and then updating the including places to ignore the parent element.)
  3. some of the same
  4. note about make in the nixos docs

I:

  • built the docs, they look good
  • built the man pages, they look good
  • wrote and tested this without much sleep
  • would like this to be backported

@jcrben
Copy link
Contributor

jcrben commented Apr 29, 2018

Can the pre-build docs be autoformatted - something like gofmt or prettier? Not sure how much whitespace matters with XML but it can affect people's editing experirence.

Last time I edited the docs, I found myself adding linebreaks and such manually - maybe I didn't need to worry about that? Sorry if this seems off-topic, but it quickly turned me off docs editing since I mostly write autoformatted code these days. Formatter would have to be a library and ideally run in CI to avoid messy diffs.

Quick search pulled up:

@grahamc
Copy link
Member Author

grahamc commented Apr 29, 2018

Hi @jcrben,

Yes, I think ultimately we could. I also think that would make it easier to hack on them! I've been taking this one small step at a time. Hopefully auto-formatting is easy to do ... :)

Some of our tags are whitespace sensitive, like program output. Let's see how xmlformat handlles it!

@grahamc
Copy link
Member Author

grahamc commented Apr 29, 2018

OK so xmllint's --format does a bad job:

-
-<para>You can disable IPv6 on a single interface using a normal sysctl (in thi
s
+  <para>You can disable IPv6 on a single interface using a normal sysctl (in t
his
 example, we use interface <varname>eth0</varname>):
 
 <programlisting>
 boot.kernel.sysctl."net.ipv6.conf.eth0.disable_ipv6" = true;
 </programlisting>
 </para>
-
-<para>As with IPv4 networking interfaces are automatically configured via
+  <para>As with IPv4 networking interfaces are automatically configured via
 DHCPv6. You can configure an interface manually:

Meanwhile, tidy does too, but in the wrong way:

-<para>For configuring a gateway, optionally with explicitly specified interfac
e:
-
-<programlisting>
-networking.defaultGateway6 = {
-  address = "fe00::1";
-  interface = "enp0s3";
-}
-</programlisting>
-</para>
+  <para>For configuring a gateway, optionally with explicitly specified
+  interface: 
+  <programlisting>networking.defaultGateway6 = { address = "fe00::1";
+  interface = "enp0s3"; }</programlisting></para>

@grahamc
Copy link
Member Author

grahamc commented Apr 29, 2018

Good news! xmlformat (http://www.kitebird.com/software/xmlformat/, with https://github.com/openSUSE/daps/blob/ac18bdbdafb4a0f4722baa933c8ac40d05e6e205/etc/docbook-xmlformat.conf#L2) works nicely:

-</para>
-
-<para>For configuring a gateway, optionally with explicitly specified interface:
-
+ </para>
+ <para>
+  For configuring a gateway, optionally with explicitly specified interface:
 <programlisting>
 networking.defaultGateway6 = {
   address = "fe00::1";
   interface = "enp0s3";
 }
 </programlisting>
-</para>
-
-<para>See <xref linkend='sec-ipv4' /> for similar examples and additional information.
-</para>
-
+ </para>
+ <para>
+  See <xref linkend='sec-ipv4' /> for similar examples and additional
+  information.
+ </para>
 </section>

@grahamc grahamc merged commit 8caaec8 into NixOS:master Apr 30, 2018
@grahamc grahamc deleted the hacking-docs branch April 30, 2018 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants