Skip to content

Commit 907db14

Browse files
committed
[REVERT LATER] add ./ to relative links in CONTRIBUTING
This won't be needed if we use pandoc AST-based filters instead of dumb substitution.
1 parent f7fd879 commit 907db14

File tree

4 files changed

+59
-56
lines changed

4 files changed

+59
-56
lines changed

CONTRIBUTING.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ This is done by making most of the options of the type `types.nullOr ....`, and
3030
Most of nixvim is dedicated to wrapping neovim plugins such that we can configure them in Nix.
3131
To add a new plugin you need to do the following.
3232

33-
1. Add a file in the correct sub-directory of [`plugins`](plugins).
33+
1. Add a file in the correct sub-directory of [`plugins`](./plugins).
3434

35-
- Most plugins should be added to [`plugins/by-name/<name>`](plugins/by-name).
35+
- Most plugins should be added to [`plugins/by-name/<name>`](./plugins/by-name).
3636
Plugins in `by-name` are automatically imported 🚀
37-
- Occasionally, you may wish to add a plugin to a directory outside of `by-name`, such as [`plugins/colorschemes`](plugins/colorschemes).
38-
If so, you will also need to add your plugin to [`plugins/default.nix`](plugins/default.nix) to ensure it gets imported.
37+
- Occasionally, you may wish to add a plugin to a directory outside of `by-name`, such as [`plugins/colorschemes`](./plugins/colorschemes).
38+
If so, you will also need to add your plugin to [`plugins/default.nix`](./plugins/default.nix) to ensure it gets imported.
3939
Note: the imports list is sorted and grouped. In vim, you can usually use `V` (visual-line mode) with the `:sort` command to achieve the desired result.
4040

4141
2. The vast majority of plugins fall into one of those two categories:
4242

4343
- _vim plugins_: They are configured through **global variables** (`g:plugin_foo_option` in vimscript and `vim.g.plugin_foo_option` in lua).\
4444
For those, you should use the `lib.nixvim.plugins.mkVimPlugin`.\
45-
-> See [this plugin](plugins/by-name/direnv/default.nix) for an example.
45+
-> See [this plugin](./plugins/by-name/direnv/default.nix) for an example.
4646
- _neovim plugins_: They are configured through a `setup` function (`require('plugin').setup({opts})`).\
4747
For those, you should use the `lib.nixvim.plugins.mkNeovimPlugin`.\
4848
-> See the [template](plugins/TEMPLATE.nix).
@@ -54,7 +54,7 @@ To add a new plugin you need to do the following.
5454
The `mkNeovimPlugin` function provides a standardize way to create a `Neovim` plugin.
5555
This is intended to be used with lua plugins that have a `setup` function,
5656
although it is flexible enough to be used with similar variants of plugins.
57-
A template plugin can be found in (plugins/TEMPLATE.nix)[https://github.com/nix-community/nixvim/blob/main/plugins/TEMPLATE.nix].
57+
A template plugin can be found in [`plugins/TEMPLATE.nix`](./plugins/TEMPLATE.nix).
5858

5959
| Parameter | Description | Required | Default Value |
6060
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------- |
@@ -113,7 +113,7 @@ thanks to package referring to the `name` attribute.
113113

114114
See the [template](plugins/TEMPLATE.nix) for a starting point.
115115

116-
Here's a simple plugin using `mkNeovimPlugin` for reference: [lsp_lines.nvim](plugins/by-name/lsp-lines/default.nix).
116+
Here's a simple plugin using `mkNeovimPlugin` for reference: [lsp_lines.nvim](./plugins/by-name/lsp-lines/default.nix).
117117

118118
#### `mkVimPlugin`
119119

@@ -214,7 +214,7 @@ In either case, you don't need to bother implementing this part. It is done auto
214214

215215
Most of the tests of nixvim consist of creating a neovim derivation with the supplied nixvim configuration, and then try to execute neovim to check for any output. All output is considered to be an error.
216216

217-
The tests are located in the [tests/test-sources](tests/test-sources) directory, and should be added to a file in the same hierarchy than the repository. For example if a plugin is defined in `./plugins/ui/foo.nix` the test should be added in `./tests/test-sources/ui/foo.nix`.
217+
The tests are located in the [tests/test-sources](./tests/test-sources) directory, and should be added to a file in the same hierarchy than the repository. For example if a plugin is defined in `./plugins/ui/foo.nix` the test should be added in `./tests/test-sources/ui/foo.nix`.
218218

219219
Tests can either be a simple attribute set, or a function taking `{pkgs}` as an input. The keys of the set are configuration names, and the values are a nixvim configuration.
220220

modules/docs/default.nix

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ lib, ... }:
1+
{ lib, pkgs, ... }:
22
{
33
options.enableMan = lib.mkOption {
44
type = lib.types.bool;
@@ -8,19 +8,29 @@
88

99
imports = [
1010
./_util.nix
11-
./files.nix
1211
./mdbook
1312
./menu
1413
./options.nix
1514
./pages.nix
1615
./platforms.nix
16+
./user-guide.nix
1717
];
1818

19-
config.docs.optionPages = {
20-
docs = {
19+
config.docs = {
20+
# TODO: contributing page
21+
pages."" = {
22+
menu.section = "header";
23+
menu.location = [ "Home" ];
24+
source = pkgs.callPackage ./readme.nix {
25+
# TODO: get `availableVersions` and `baseHref` from module options
26+
};
27+
};
28+
optionPages.docs = {
2129
optionScopes = [ "docs" ];
2230
page.menu.location = [ "docs" ];
2331
page.text = ''
32+
# docs
33+
2434
Internal options used to construct these docs.
2535
'';
2636
};

modules/docs/files.nix

-44
This file was deleted.

modules/docs/user-guide.nix

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
lib,
3+
pkgs,
4+
...
5+
}:
6+
let
7+
user-guide = ../../docs/user-guide;
8+
9+
# TODO: consider configuring this as a module option?
10+
# Or moving config-examples out of the user-guide directory?
11+
sourceTransformers = {
12+
config-examples =
13+
template:
14+
pkgs.callPackage ./user-configs.nix {
15+
inherit template;
16+
};
17+
};
18+
in
19+
{
20+
docs.pages = lib.concatMapAttrs (
21+
name: type:
22+
let
23+
title = lib.removeSuffix ".md" name;
24+
# Get this file's transformer, if there is one...
25+
# Most user-guides we use the file as-is
26+
transformer = sourceTransformers.${title} or lib.id;
27+
in
28+
lib.optionalAttrs (type == "regular" && lib.hasSuffix ".md" name) {
29+
"user-guide/${title}" = {
30+
menu.section = "user-guide";
31+
# TODO: define user-facing titles to show in the menu...
32+
menu.location = [ title ];
33+
source = transformer "${user-guide}/${name}";
34+
};
35+
}
36+
) (builtins.readDir user-guide);
37+
}

0 commit comments

Comments
 (0)