Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a2db183
Add directory-contents package
srid Dec 24, 2020
2edb4ee
Remove the useless minVersion check
srid Dec 24, 2020
4f18ce5
WIP traversal using directory-contents Tree
srid Dec 24, 2020
2da4446
Auto-tag zettels based on their parent directory
srid Dec 24, 2020
39fe677
Fix tests, and refactor a bit
srid Dec 24, 2020
3691c4a
Start a faux Plugin system
srid Dec 24, 2020
d58953e
WIP directory folgezettel
srid Dec 25, 2020
31b8fa1
Refactor and make more functional
srid Dec 25, 2020
af04dba
Use base filename as zettel ID for directory zettels
srid Dec 25, 2020
e8f7068
Move bulk of dirfolge code to Plugin module
srid Dec 25, 2020
9e98d56
Remove some redundant tagging behaviour
srid Dec 25, 2020
84d11a9
Disable tests for directory-contents
srid Dec 25, 2020
2807d06
Get rid of annoying tooltip styling from semantic UI
srid Dec 25, 2020
8ff365e
Revert "Disable tests for directory-contents"
srid Dec 25, 2020
64a7593
disable macos builder
srid Dec 25, 2020
c7bcf42
Don't branch from index zettel
srid Dec 26, 2020
4973cc2
Introduce Plugin type
srid Dec 26, 2020
2f33877
Refactor Error type in its own module
srid Dec 26, 2020
3f5ea40
Refactor plugin type to move towards library
srid Dec 26, 2020
b98f745
Remove unused module
srid Dec 26, 2020
0dbd632
Factor out "plugin data" on its own type (GADT)
srid Dec 26, 2020
10fc4c8
Lighten up the link theme background color on hover
srid Dec 26, 2020
d0762bb
Move some modules to library
srid Dec 27, 2020
e1ee10e
Move rendering function to plugin
srid Dec 27, 2020
9a0332c
Simplify the Plugin GADT
srid Dec 27, 2020
b458356
Display parent link ".."
srid Dec 27, 2020
0cab86c
Move plugin data to its own module
srid Dec 27, 2020
5c153b2
Make plugins configurable
srid Dec 27, 2020
a9c09bb
Fix cache.json not placed in `-d` directory
srid Dec 27, 2020
f997468
Support .neuronignore
srid Dec 27, 2020
201e584
Make .neuronignore its own plugin
srid Dec 27, 2020
d59cf5f
directory-contents: disable tests, and reenable macos CI
srid Dec 27, 2020
a025438
Refactor Plugin API
srid Dec 27, 2020
d48571b
dirtree: Deal with Foo.md existing elsewhere in tree, to Foo/
srid Dec 28, 2020
a69e0b6
Bake in perf measurements
srid Dec 28, 2020
7b0d904
neuronignore: obviate having to specify ./
srid Dec 28, 2020
4d40ffe
Add documentation
srid Dec 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- Introducing *impulse* -- foundation for upcoming advanced search, replacing both z-index and legacy JS search (#108)
- Remove (experimental) support for org-mode in v2 (use `v1` branch if you need org-mode)
- Plugin support
- dirtree: Treat directories as zettels, forming automatic folgezettel connections to their children. (#497)
- neuronignore: Exclude directories and markdown files via `.neuronignore`. (#499)
- By default, recursively read Markdown files in notes directory. This behaviour can be disabled via the neuronignore plugin.

## Unreleased (v1 + v2)

Expand Down
2 changes: 2 additions & 0 deletions dep/directory-contents/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# DO NOT HAND-EDIT THIS FILE
import (import ./thunk.nix)
8 changes: 8 additions & 0 deletions dep/directory-contents/github.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"owner": "srid",
"repo": "directory-contents",
"branch": "sans-tests",
"private": false,
"rev": "43025f4739590c82cbfc8dcf15d0ff17b1f37324",
"sha256": "1ianv9y4gzb1835bw7xbjn94wpbm6znq006hdayya0ih1iqz2csq"
}
9 changes: 9 additions & 0 deletions dep/directory-contents/thunk.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# DO NOT HAND-EDIT THIS FILE
let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }:
if !fetchSubmodules && !private then builtins.fetchTarball {
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256;
} else (import <nixpkgs> {}).fetchFromGitHub {
inherit owner repo rev sha256 fetchSubmodules private;
};
json = builtins.fromJSON (builtins.readFile ./github.json);
in fetch json
10 changes: 10 additions & 0 deletions guide/.neuronignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Ignore top-level dotfiles and dotdirs
.*/**

# Ignore project specific files
README.md
CHANGELOG.md
LICENSE.md

# Ignore everything under sub directories
#*/*/**
21 changes: 21 additions & 0 deletions guide/Plugins.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
slug: plugins
---

Neuron includes several plugins, some of them are enabled by default.

You can turn on or turn off these plugins in [[configuration]]. For example, the following setting in your `neuron.dhall` will enable the [[Ignoring files]] plugin, while leaving others (such as [[Directory Tree]]) disabled.

```dhall
{ plugins = [ "neuronignore" ]
}
```

To enable *all* plugins,

```dhall
{ plugins = [ "neuronignore", "dirtree" ]
}
```

Available plugins are listed immediately below.
20 changes: 20 additions & 0 deletions guide/Plugins/Directory Tree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
slug: dirtree
---

The *Directory Tree* plugin achieves two things:

1. Create a "directory zettel" on the fly for each sub-directory
2. Create folgezettel links (see [[linking]]) automatically reflecting the directory tree

## Directory Zettel

Given a folder `./Project/HouseWarming/`, this plugin will create two zettels with [[id]] `Project` and `HouseWarming`. Directory names must be unique, inasmuch they directly reflect [[id]] which must also be unique. In the [[web]], neuron will display the "contents" of a directory beneath the zettel content.

The zettel content for directory zettels are by default empty. However, you may explicitly specify them by creating zettel files using the same [[id]]; for the example above, you may create `./Project.md` and `./Project/HouseWarming.md` - and they will be "merged" to the auto-created directory zettels.

## Links & tags created

A [[folgezettel-heterarchy]] is formed, reflecting the directory tree on disk, with the exception of the `index` zettel[^man]. The forming of links is based on hierarchical [[[tags]]] (reflecting the relative path), that every normal zettel and directory zettel is automatically tagged with.

[^man]: You may manually form these relationships by adding `[[[z:zettels?tag=index]]]` to the top-level `index.md`
21 changes: 21 additions & 0 deletions guide/Plugins/Ignoring files.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
slug: neuronignore
---

The `neuronignore` plugin allows you to specify a list of patterns that will be used to ignore specific Markdown files.

Add a file named `.neuronignore` to your notes directory. It should look like this:

```ini
# Ignore top-level dotfiles and dotdirs
.*/**

# Ignore project specific files
README.md
CHANGELOG.md
LICENSE.md

# Ignore everything under sub directories
# (if not using dirtree plugin)
*/*/**
```
6 changes: 2 additions & 4 deletions guide/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ You may configure the parameters of your web interface by adding an optional con
| Field name | Description |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **`siteTitle`** | Your Neuron site's title |
| **`author`** | Author name |
| **`siteBaseUrl`** | The base URL of your published Neuron site. Setting the base URL will enable [breadcrumbs](https://developers.google.com/search/docs/data-types/breadcrumb) in your site's structured data |
| **`author`** | Author name |
| **`theme`** | Color scheme to use for your site. Value must be [one of the color names](https://semantic-ui.com/usage/theming.html#sitewide-defaults) supported by SemanticUI. |
| **`editUrl`** | The URL (without the zettel filename) to edit zettels. To remove the edit button from the navbar, remove this entry from your configuration. |
| **`minVersion`** | The minimum neuron version your site must be generated with. |


| **`plugins`** | See [[Plugins]] |
## Example

```json
Expand Down
1 change: 1 addition & 0 deletions guide/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Core concepts:

- [[[id]]]
- [[[markdown]]]
- [[[Plugins]]]

For generating static sites:

Expand Down
2 changes: 2 additions & 0 deletions impulse/project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ let
impulse = pkgs.lib.cleanSource (gitignoreSource ./.);

# neuron & its dependencies (not already in reflex-platform)
# TODO: Use hackGet for direct/no-reload development?
neuron = pkgs.runCommand "neuron" { buildInputs = [ ]; }
''
mkdir -p $out/src
Expand All @@ -30,6 +31,7 @@ let
LINE=`grep -n LIBMARKER ${neuronSrc}/neuron.cabal | cut -f1 -d:`
head -n $LINE ${neuronSrc}/neuron.cabal > $out/neuron.cabal
'';
directory-contents = import ../dep/directory-contents/thunk.nix;
reflex-dom-pandoc = import ../dep/reflex-dom-pandoc/thunk.nix;
pandoc-link-context = import ../dep/pandoc-link-context/thunk.nix;
commonmark = cm + "/commonmark";
Expand Down
Loading