update readme

This commit is contained in:
tristan 2024-01-01 00:04:17 +00:00
parent cb6d9652f8
commit b734310051
3 changed files with 36 additions and 11 deletions

View file

@ -1,4 +1,3 @@
# Nixite # Nixite
A static site generator made in Nix. A static site generator made in Nix.
@ -21,13 +20,37 @@ You can process your site with the power of nixpkgs - eg you could process image
Read `flake.nix` for basic usage. Read `flake.nix` for basic usage.
The default package will build the site: The default package will serve the site locally (using caddy)
```sh ```sh
nix build . nix run .
``` ```
You can also serve it locally (using caddy) Or you can build it raw:
```sh ```sh
nix run .#serve nix build .#raw
``` ```
## features
- [X] file paths
- [X] global styles
- [X] custom components with styles
- [X] component extend / inheritance
### markdown
- [ ] frontmatter
- [X] headers
- [X] paragraphs
- [ ] tables
- [ ] lists
- [ ] checkboxes
- [ ] images
- [ ] links
- [ ] codeblocks
- [ ] subscript
- [ ] highlight
- [ ] italics
- [ ] bold

View file

@ -8,9 +8,9 @@
nixite = import ./nixite/. { inherit pkgs; }; nixite = import ./nixite/. { inherit pkgs; };
in nixite // { in nixite // {
packages.${system} = { packages.${system} = {
default = nixite.mkSite (nixite.site.applyStyle ./testing/src/style.css raw = nixite.mkSite (nixite.site.applyStyle ./testing/src/style.css
(nixite.site.extractPaths { (nixite.site.extractPaths {
"index.html" = with nixite.elems; "test" = with nixite.elems;
(Doc [ (Doc [
[ [
(title "Nixite") (title "Nixite")
@ -19,16 +19,18 @@
type = "image/png"; type = "image/png";
href = ./testing/src/favicon.png; href = ./testing/src/favicon.png;
} "") } "")
(a "/readme" "Readme")
] ]
(main [ (main [
(a "/blog" "blog") (a "/blog" "blog")
(list [ "item 1" "item 2" "item 3" ]) (List [ "item 1" "item 2" "item 3" ])
]) ])
]); ]);
blog = nixite.md.readDir ./testing/blog; blog = nixite.md.readDir ./testing/blog;
"index.html" = nixite.md.mdToPage ./README.md;
})); }));
serve = nixite.serve self.packages.${system}.default; default = nixite.serve self.packages.${system}.raw;
test = let test = import ./testing/import.nix; test = let test = import ./testing/import.nix;
in pkgs.writeShellScriptBin "test" '' in pkgs.writeShellScriptBin "test" ''

View file

@ -7,9 +7,9 @@ let
''${key}="${toString value}"''; ''${key}="${toString value}"'';
in rec { in rec {
toHTML = elem: toHTML = elem:
if builtins.typeOf elem == "string" then if builtins.isString elem then
elem elem
else if builtins.typeOf elem == "list" then else if builtins.isList elem then
builtins.toString (map toHTML elem) builtins.toString (map toHTML elem)
else else
"<${elem.tag} ${writeAttrs elem.attrs}>${ "<${elem.tag} ${writeAttrs elem.attrs}>${