~tagglink/node

ref: 46573768ab7a9e357fc5a8353b6fd98a636943fe node/README.md -rw-r--r-- 2.3 KiB
46573768 — Tomas Granlund new repo for sourcehut, initial commit 1 year, 3 months ago

#Node

Node is a tool that allows anyone to write a website in simple Markdown. Node automatically generates a <nav> that allows users to navigate your content easily and intuitively.

The layout of the website is described in a .tree file.

My Node index.md
<Projects projects.md
<<BMP2CHR bmp2chr.md
<Blog blog.md
<<Awesome Blog Post awesome.md
<Now now.md

When Node is run, it parses the .md file at the end of each line and produces a HTML document with a nav for each one. The <nav> for "Awesome Blog Post" would look like this:

<nav>
	<ul>
		<li><a href="projects.html">Projects</a></li>
		<li><a href="blog.html">Blog</a></li>
		<ul>
			<li><a href="awesome.html">Awesome Blog Post</a></li>
		</ul>
	</ul>
</nav>
<main> ... content generated from awesome.md ... </main>

#Build

clang notes.c md_renderer.c md4c/md4c.c helpers.c

Clang is the most accessible C compiler for windows users and the one I use, but it should compile with any C compiler that supports C99.

#Use

node tree-file.tree -h head.html -f foot.html -c path/to/md/content -o path/to/html/output

The file given to -h must contain two occurrences of %s, where the first will be replaced by the note's title, and the second with the site's nav.

Example head.html:

<!DOCTYPE html>
<html>
<head>
  <meta charset='UTF-8' />
  <title>%s - node</title>
  <link rel="stylesheet" href="/css/style.css" />
  <link rel="icon" href="/res/icon-128x128.png" type="image/png" sizes="128x128" />
  <link rel="icon" href="/res/icon-64x64.png" type="image/png" sizes="64x64" />
  <link rel="icon" href="/res/icon-32x32.png" type="image/png" sizes="32x32" />
  <link rel="icon" href="/res/icon-16x16.png" type="image/png" sizes="16x16" />
</head>
<body>
  <header>
    <a href="/index.html">node</a>
  </header>
  <nav><ul>%s</ul></nav>
  <main>

Example foot.html:

</main>
  <footer>
    <a href="https://sr.ht/~MeOnSourcehut/"><img src="/res/sourcehut.svg"></a>
    <span>My Name</span>
  </footer>
</body>
</html>
```

## Dependencies
Node uses [MD4C](https://github.com/mity/md4c).

## Improvements
* Cross-platform directory creation when a directory is missing from a path
* Better error messages when parsing tree files