├── config.nims
├── test
├── subdir
│ ├── safds
│ ├── README.md
│ ├── subsubdir
│ │ └── markdown_subsubdir.md
│ ├── lenna.jpg
│ └── markdown_subdir.md
├── test.md
├── README.md
├── z_latest.md
└── latest.md
├── .gitignore
├── nerc.nimble
├── LICENSE
├── src
├── res
│ ├── config.json
│ ├── template.html
│ └── styles.css
└── nerc.nim
└── README.md
/config.nims:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/test/subdir/safds:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/test/subdir/README.md:
--------------------------------------------------------------------------------
1 | # Subdir Index
2 |
--------------------------------------------------------------------------------
/test/subdir/subsubdir/markdown_subsubdir.md:
--------------------------------------------------------------------------------
1 | # BLARGH!
2 |
--------------------------------------------------------------------------------
/test/test.md:
--------------------------------------------------------------------------------
1 | # This is also a test
2 |
3 |
4 |
5 | Keep moving.
6 |
--------------------------------------------------------------------------------
/test/subdir/lenna.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/8bitprodigy/nerc/HEAD/test/subdir/lenna.jpg
--------------------------------------------------------------------------------
/test/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # This is a test
4 |
5 | Nothing to see here, folks.
6 |
7 |
8 | Move along.
9 |
--------------------------------------------------------------------------------
/test/subdir/markdown_subdir.md:
--------------------------------------------------------------------------------
1 | # This is in a subdirectory
2 |
3 |
4 |
5 | 
6 |
--------------------------------------------------------------------------------
/test/z_latest.md:
--------------------------------------------------------------------------------
1 | # This is the actual newest file
2 |
3 |
4 |
5 | With `"sort"` set to `"newest"`, this should be sorted to appear first in the sidebar.
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | nerc
2 | test/*.css
3 | test/*.json
4 | test/*.htm
5 | test/*.html
6 | test/*/*.css
7 | test/*/*.json
8 | test/*/*.htm
9 | test/*/*.html
10 | test/*/*/*.css
11 | test/*/*/*.json
12 | test/*/*/*.htm
13 | test/*/*/*.html
14 |
--------------------------------------------------------------------------------
/nerc.nimble:
--------------------------------------------------------------------------------
1 | # Package
2 |
3 | version = "1.2.0"
4 | author = "8bitprodigy"
5 | description = "A simple web anti-framework written in Nim."
6 | license = "0BSD"
7 | srcDir = "src"
8 | bin = @["nerc"]
9 |
10 |
11 | # Dependencies
12 |
13 | requires "nim >= 2.2.2"
14 | requires "markdown"
15 |
--------------------------------------------------------------------------------
/test/latest.md:
--------------------------------------------------------------------------------
1 | # Latest
2 |
3 | This is the latest document created.
4 |
5 | If you set `"index": "newest"` in your `config.json` file, you can have the latest file created be the one that becomes `index.htm`.
6 |
7 | This is useful if you intend to use `nerc` for a blog.
8 |
9 | ## My Linkable header
10 |
11 | [Link to my linkable header.](#my-linkable-header)
12 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Zero-Clause BSD
2 |
3 | ===============
4 |
5 | Permission to use, copy, modify, and/or distribute this software for
6 | any purpose with or without fee is hereby granted.
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
9 | WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
10 | OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE
11 | FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
12 | DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
13 | AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
14 | OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 |
16 |
--------------------------------------------------------------------------------
/src/res/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "index": "$readme",
3 | "sort": "alphabetical",
4 | "page title": "Default nerc site",
5 | "links": [
6 | {"label": "Main", "link": "/"},
7 | {"label": "", "link": "SPACER"},
8 | {"label": "nerc", "link": "https://github.com/8bitprodigy/nerc"},
9 | ],
10 | "site title": "Default nerc site",
11 | "subtitle": "These settings can be overridden by putting a config.json file in the root of this nerc site.",
12 | "upper nav": false,
13 | "doc title": true,
14 | "lower nav": false,
15 | "footer left": "This page was generated by nerc.",
16 | "footer right": "nerc is public domain/0BSD software."
17 | }
18 |
--------------------------------------------------------------------------------
/src/res/template.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
25 |
26 |
29 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/res/styles.css:
--------------------------------------------------------------------------------
1 | * {
2 | margin: 0px;
3 | }
4 |
5 | body {
6 | width: 100%;
7 | height: 100%;
8 | display: flex;
9 | flex-direction: column;
10 | position: absolute;
11 | padding: 0px;
12 | }
13 |
14 | .spacer {
15 | display: flex;
16 | flex-grow: 1;
17 | }
18 |
19 | .nerc {
20 | margin:5px;
21 | display: flex;
22 | padding: 0px;
23 | }
24 |
25 | #container {
26 | display: flex;
27 | flex-direction: column;
28 | height:100vh;
29 | padding: 5px;
30 | width: 1024px;
31 | margin: auto;
32 | }
33 |
34 | #links {
35 | padding-left: 8px;
36 | padding-right: 8px;
37 | }
38 |
39 | #header {
40 | padding-left: 8px;
41 | }
42 | #header h1 {
43 | display: block;
44 | margin-top: auto;
45 | margin-right: 20px;
46 | }
47 | #header h2 {
48 | display: block;
49 | margin-top: auto;
50 | }
51 |
52 | #body {
53 | width: 100%;
54 | display:flex;
55 | flex-grow: 1;
56 | flex-direction: row;
57 | }
58 |
59 | #sidebar {
60 | display: block;
61 | left: 0px;
62 | padding-top: 20px;
63 | padding-left: 40px;
64 | min-width:200px;
65 | flex-shrink:0;
66 | }
67 | #sidebar ul li {
68 | padding-left: 8px;
69 | font-size: 14pt;
70 | display: list-item;
71 | align-items: center;
72 | }
73 |
74 | #content {
75 | display: block;
76 | flex-grow: 1;
77 | padding-left: 80px;
78 | padding-right: 80px;
79 | padding-top: 40px;
80 | padding-bottom: 40px;
81 | }
82 | #content h1 {
83 | display: block;
84 | text-align: center;
85 | border-bottom: 1px solid black;
86 | margin-bottom: 24px;
87 | }
88 | #content p {
89 | text-indent: 1.5em;
90 | display: block;
91 | max-width: 800px;
92 | margin: auto;
93 | }
94 | #content img {
95 | display: block;
96 | width: 100%;
97 | height: auto;
98 | margin: auto;
99 | }
100 |
101 | #footer {
102 | padding-left:8px;
103 | padding-right: 8px;
104 | }
105 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # nerc
2 |
3 | Anti-web anti-framework in Nim.
4 |
5 | ## Rationale
6 |
7 | Too many web frameworks are written in slow, heavy, bloated interpreted languages, reflective of most of web technologies, so this is an *anti*-web *anti*-framework written in a fast, lightweight, and *nim*ble compiled language.
8 |
9 | ## Function
10 |
11 | Converts markdown files into html files on a directory basis.
12 |
13 | ## Usage
14 |
15 | Navigate to your directory you wish to be the root of your website and run:
16 |
17 | ```
18 | nerc
19 | ```
20 |
21 | Then upload the contents of that directory to the root of your website's hosting directory.
22 |
23 | ### Things to note
24 |
25 | - `readme.md`(case insensitive) files will become `index.htm` files so you can use github hosting for your website, and people visiting the repo will get more or less the same experience.
26 |
27 | - File and directory names become page titles with underscores turned into spaces, so `My_Portfolio.md` will be given the page name `My Portfolio` when linked in the sidebar and after the site title in the browser titebar/tab.
28 |
29 | - Files and directories starting with a `.` or `_` will be ignored for linkage to ensure directories like `.git/` don't get scanned.
30 |
31 | - Directories that don't contain a `readme.md` will not be linkified in the sidebar, but any `.md` documents they contain will be.
32 |
33 | - You can add your own html pages you made, but they will only be linkified if they end in `.html`.
34 |
35 | ## Options
36 |
37 | Options can be overridden on a per-directory basis. Each directory can have its own `config.json`, `styles.css`, and `template.html`, overriding one or more of a parent directory's settings.
38 |
39 | ### config.json
40 |
41 | You'll likely first wish to create your own `config.json` file to override the default settings built in to `nerc`.
42 | This is a list of the various config options:
43 |
44 | | **Key** | **Value Type** | **Description** |
45 | | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
46 | | `"index"` | string (default: `"$readme"`): `"newest"` to use the newest created file, to select a specific file name (excluding file extension), make the first character a `$`. | Sets what document gets converted into `index.htm`. |
47 | | `"sort"` | string (default: `"alphabetical"`): `"alphabetical"` to sort alphabetically, `"newest"` to sort by newest | Sets how page links are sorted in the sidebar. |
48 | | `"page title"` | string | Sets the page's title tag (in the browser window titlebar/tab). |
49 | | `"links"` | array of JSON objects: `{"label": [string to hyperlink], "link":[string of URL to link to]}` | Sets the links that appear at the top of the page. Spacers can be inserted by inserting the following JSON object: `{"label": "", "link": "SPACER"}` |
50 | | `"site title"` | string | Sets the title at the top of each page, below the links row. |
51 | | `"subtitle"` | string | Sets the subtitle for the site that appears next to the title. |
52 | | `"upper nav"` | bool (default: `false`) | If true inserts previous/next navigation links at the top of the document to navigate to other documents within the current directory |
53 | | `"doc title"` | bool (default: `true`) | If true, inserts the document's formatted file name (underscores and file extension removed) into the top of the document in a `