diff --git a/README.md b/README.md index 60553ed..b8c512c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ - # Nixite 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. -The default package will build the site: +The default package will serve the site locally (using caddy) + ```sh -nix build . +nix run . ``` -You can also serve it locally (using caddy) +Or you can build it raw: + ```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 diff --git a/flake.nix b/flake.nix index d56a33a..f94c214 100644 --- a/flake.nix +++ b/flake.nix @@ -8,9 +8,9 @@ nixite = import ./nixite/. { inherit pkgs; }; in nixite // { 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 { - "index.html" = with nixite.elems; + "test" = with nixite.elems; (Doc [ [ (title "Nixite") @@ -19,16 +19,18 @@ type = "image/png"; href = ./testing/src/favicon.png; } "") + (a "/readme" "Readme") ] (main [ (a "/blog" "blog") - (list [ "item 1" "item 2" "item 3" ]) + (List [ "item 1" "item 2" "item 3" ]) ]) ]); 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; in pkgs.writeShellScriptBin "test" '' diff --git a/nixite/html.nix b/nixite/html.nix index 0d61300..eceb752 100644 --- a/nixite/html.nix +++ b/nixite/html.nix @@ -7,9 +7,9 @@ let ''${key}="${toString value}"''; in rec { toHTML = elem: - if builtins.typeOf elem == "string" then + if builtins.isString elem then elem - else if builtins.typeOf elem == "list" then + else if builtins.isList elem then builtins.toString (map toHTML elem) else "<${elem.tag} ${writeAttrs elem.attrs}>${