!avYyleMexqjFHoqrME:nixos.org

Nix Documentation

434 Members
Discussion about documentation improvements around the Nix ecosystem91 Servers

Load older messages


SenderMessageTime
14 Aug 2023
@osslate:fsfe.orgosslate If recognizing/extracting repl codeblocks is the goal, it might be better to engineer a solution that enumerates over nix (or text) codeblocks and identifies the nix repl prompt 15:24:42
@mightyiam:matrix.org@mightyiam:matrix.org

Because I really want to mark some fenced code blocks as nix-repl.

I wrote a program that parses the same sources, unrelated to sphinx, runs those nix repl examples in actual nix repl.

15:24:52
@mightyiam:matrix.org@mightyiam:matrix.orgIdentifying the prompt sounds like a workaround that affects the author of the documentation.15:26:22
@mightyiam:matrix.org@mightyiam:matrix.orgThe author of the documentation "wants", according to me, to have nix-repl as the language tag.15:26:45
@mightyiam:matrix.org@mightyiam:matrix.org All the silly extension has to do, is to replace all nix-repl language tags with text. 15:27:20
@osslate:fsfe.orgosslateIs this a thing that people have asked for previously?15:27:35
@yukiisbored:matrix.orgYuki Langley (they/them)

sphinx.ext.doctest is an extension which does something similar: https://github.com/sphinx-doc/sphinx/blob/0bad447070d45fc5538aed9bf15a1716c628f321/sphinx/ext/doctest.py#L157

https://www.sphinx-doc.org/en/master/usage/extensions/doctest.html#module-sphinx.ext.doctest

15:27:50
@yukiisbored:matrix.orgYuki Langley (they/them) *

sphinx.ext.doctest is an extension which does something similar (but for Python): https://github.com/sphinx-doc/sphinx/blob/0bad447070d45fc5538aed9bf15a1716c628f321/sphinx/ext/doctest.py#L157

https://www.sphinx-doc.org/en/master/usage/extensions/doctest.html#module-sphinx.ext.doctest

15:28:00
@mightyiam:matrix.org@mightyiam:matrix.orgThe testing part is implemented.15:28:26
@osslate:fsfe.orgosslateIn any case, you might get better support from the Sphinx chat channel unless we've resident Sphinx experts about15:28:27
@proofconstruction:matrix.orgproofconstruction
In reply to @osslate:fsfe.org
In any case, you might get better support from the Sphinx chat channel unless we've resident Sphinx experts about
Yuki is the resident Sphinx expert 😁
15:28:57
@mightyiam:matrix.org@mightyiam:matrix.orgI've been asked to implement this, yes.15:29:03
@osslate:fsfe.orgosslateAha!15:29:11
@yukiisbored:matrix.orgYuki Langley (they/them)

also just in case, You do directives in MyST like this:

\`\`\`{nix-repl}
\`\`\`
15:29:51
@yukiisbored:matrix.orgYuki Langley (they/them) *

also just in case, You do directives in MyST like this:

```{nix-repl}
15:30:00
@yukiisbored:matrix.orgYuki Langley (they/them) *

also just in case, You do directives in MyST like this:

```{nix-repl}
```
15:30:08
@yukiisbored:matrix.orgYuki Langley (they/them)https://myst-parser.readthedocs.io/en/v0.17.1/syntax/reference.html#extended-block-tokens15:30:11
@yukiisbored:matrix.orgYuki Langley (they/them)

If you just do the following:

```nix-repl
```

MyST might parse it as you wanna do a code-block directive^^]

15:30:33
@yukiisbored:matrix.orgYuki Langley (they/them) *

If you just do the following:

```nix-repl
```

MyST might parse it as you wanna do a code-block directive^^

15:30:37
@yukiisbored:matrix.orgYuki Langley (they/them) *

If you just do the following:

```nix-repl
```

MyST might parse it as you wanna do a code-block directive (and therefore Pygments will complain that nix-repl doesn't exist)^^

15:31:06
@yukiisbored:matrix.orgYuki Langley (they/them) *

also just in case, You do directives in MyST like this:

```{nix-repl}
nix-repl> 1 == 1
true
```
15:32:18
@yukiisbored:matrix.orgYuki Langley (they/them) *

If you just do the following:

```nix-repl
nix-repl> 1 == 1
true
```

MyST might parse it as you wanna do a code-block directive (and therefore Pygments will complain that nix-repl doesn't exist)^^

15:32:24
@yukiisbored:matrix.orgYuki Langley (they/them) *

also just in case this is a syntax issue, you do directives in MyST like this:

```{nix-repl}
nix-repl> 1 == 1
true
```
15:32:42
@yukiisbored:matrix.orgYuki Langley (they/them) *

also just in case this is a syntax issue in your MyST/Markdown file, you do directives in MyST like this:

```{nix-repl}
nix-repl> 1 == 1
true
```
15:32:55
@mightyiam:matrix.org@mightyiam:matrix.orgI can't have pygments complaining. We turn warnings into errors.15:33:37
@yukiisbored:matrix.orgYuki Langley (they/them)It's still complaining?15:34:01
@yukiisbored:matrix.orgYuki Langley (they/them)Is there a github repo/branch so I can take a look at the entire code?15:35:14
@mightyiam:matrix.org@mightyiam:matrix.orghttps://github.com/mightyiam/nix.dev/tree/mob/doctest15:37:49
@yukiisbored:matrix.orgYuki Langley (they/them)
In reply to @mightyiam:matrix.org
https://github.com/mightyiam/nix.dev/tree/mob/doctest
You need to but nix-repl in between brackets {} so MyST knows that it is a directive not a code-block: https://github.com/mightyiam/nix.dev/commit/575fafaa0137719732c042b8fe9fd583e51637eb#diff-e07c1c53347d65c8d474c94912ab24825952ee9b2cab073d8699afdfc6464934R121-R135
15:40:05
@yukiisbored:matrix.orgYuki Langley (they/them)
In reply to @yukiisbored:matrix.org

also just in case this is a syntax issue in your MyST/Markdown file, you do directives in MyST like this:

```{nix-repl}
nix-repl> 1 == 1
true
```
llike this
15:40:21

Show newer messages


Back to Room ListRoom Version: 6