From aa12fd9d08338bb2ed56c1d4dbcba72d19798e64 Mon Sep 17 00:00:00 2001 From: srid <3998+srid@users.noreply.github.com> Date: Thu, 29 Apr 2021 00:06:05 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20=20@=206516a?= =?UTF-8?q?c2cf52ec378f9466d52ee02975daa9db23a=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cache.json | 2 +- examples.html | 2 +- guide.html | 2 +- impulse.html | 2 +- index.html | 2 +- preview.html | 2 +- syntax-highlighting.html | 2 +- tutorial.html | 2 +- typed-routes.html | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cache.json b/cache.json index 09e6bfa..e5f1b5d 100644 --- a/cache.json +++ b/cache.json @@ -1 +1 @@ -{"Graph":{"adjacencyMap":{"syntax-highlighting":{},"typed-routes":{"tutorial":["cf",[]],"preview":["cf",[]]},"tutorial":{"preview":["cf",[]]},"guide":{"syntax-highlighting":["folge",[]],"typed-routes":["folge",[]],"tutorial":["cf",[]]},"preview":{},"examples":{},"index":{"tutorial":["folge",[]],"guide":["folge",[]],"preview":["folge",[]],"examples":["folge",[]]}},"vertices":{"syntax-highlighting":{"Path":"./syntax-highlighting.md","Slug":"syntax-highlighting","ID":"syntax-highlighting","Meta":{"tags":["guide"]},"Title":"Enable Syntax Highlighting"},"typed-routes":{"Path":"./typed-routes.md","Slug":"typed-routes","ID":"typed-routes","Meta":{"tags":["guide"]},"Title":"Typed Routes"},"tutorial":{"Path":"./tutorial.md","Slug":"tutorial","ID":"tutorial","Meta":{"tags":[]},"Title":"Tutorial"},"guide":{"Path":"./guide.md","Slug":"guide","ID":"guide","Meta":{"tags":[]},"Title":"Guide"},"preview":{"Path":"./preview.md","Slug":"preview","ID":"preview","Meta":{"tags":[]},"Title":"Quick Preview"},"examples":{"Path":"./examples.md","Slug":"examples","ID":"examples","Meta":{"tags":[]},"Title":"Examples"},"index":{"Path":"./index.md","Slug":"index","ID":"index","Meta":{"tags":[]},"Title":"Rib"}}},"NeuronVersion":"1.9.25.1","Config":{"editUrl":"https://github.com/srid/rib/edit/master/guide/","plugins":["neuronignore","links","tags","uptree","feed"],"siteBaseUrl":"https://rib.srid.ca","author":null,"siteTitle":"Rib","theme":"green"},"Errors":{}} \ No newline at end of file +{"Graph":{"adjacencyMap":{"syntax-highlighting":{},"typed-routes":{"tutorial":["cf",[]],"preview":["cf",[]]},"tutorial":{"preview":["cf",[]]},"guide":{"syntax-highlighting":["folge",[]],"typed-routes":["folge",[]],"tutorial":["cf",[]]},"preview":{},"examples":{},"index":{"tutorial":["folge",[]],"guide":["folge",[]],"preview":["folge",[]],"examples":["folge",[]]}},"vertices":{"syntax-highlighting":{"Path":"./syntax-highlighting.md","Slug":"syntax-highlighting","ID":"syntax-highlighting","Meta":{"tags":["guide"]},"Title":"Enable Syntax Highlighting"},"typed-routes":{"Path":"./typed-routes.md","Slug":"typed-routes","ID":"typed-routes","Meta":{"tags":["guide"]},"Title":"Typed Routes"},"tutorial":{"Path":"./tutorial.md","Slug":"tutorial","ID":"tutorial","Meta":{"tags":[]},"Title":"Tutorial"},"guide":{"Path":"./guide.md","Slug":"guide","ID":"guide","Meta":{"tags":[]},"Title":"Guide"},"preview":{"Path":"./preview.md","Slug":"preview","ID":"preview","Meta":{"tags":[]},"Title":"Quick Preview"},"examples":{"Path":"./examples.md","Slug":"examples","ID":"examples","Meta":{"tags":[]},"Title":"Examples"},"index":{"Path":"./index.md","Slug":"index","ID":"index","Meta":{"tags":[]},"Title":"Rib"}}},"NeuronVersion":"1.9.27.2","Config":{"editUrl":"https://github.com/srid/rib/edit/master/guide/","plugins":["neuronignore","links","tags","uptree","feed"],"siteBaseUrl":"https://rib.srid.ca","author":null,"siteTitle":"Rib","theme":"green"},"Errors":{}} \ No newline at end of file diff --git a/examples.html b/examples.html index bd4f581..f92c881 100644 --- a/examples.html +++ b/examples.html @@ -1 +1 @@ -Examples - Rib
\ No newline at end of file +Examples - Rib
\ No newline at end of file diff --git a/guide.html b/guide.html index 1416aee..b938b93 100644 --- a/guide.html +++ b/guide.html @@ -1 +1 @@ -Guide - Rib
\ No newline at end of file +Guide - Rib
\ No newline at end of file diff --git a/impulse.html b/impulse.html index 23ce87b..fab7318 100644 --- a/impulse.html +++ b/impulse.html @@ -1 +1 @@ -Impulse - Rib

Impulse

Errors

The notebook has 7 notes and 10 links. It has 1 cluster in its folgezettel graph. Each cluster's folgezettel heterarchy is rendered as a forest.

\ No newline at end of file +Impulse - Rib

Impulse

Errors

The notebook has 7 notes and 10 links. It has 1 cluster in its folgezettel graph. Each cluster's folgezettel heterarchy is rendered as a forest.

\ No newline at end of file diff --git a/index.html b/index.html index f1623af..f2bfa6e 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -Rib

Rib

Rib is a Haskell static site generator based on Shake, with a delightful development experience.

Features

Rib composes existing tools designed to do their task well, instead of reinventing their capabilities. Time spent using rib is time spent learning them.

  • Use Shake as the core build engine.
  • Write HTML & CSS in Haskell with natural flow (using Lucid & Clay)
    • Optional route system for type-safe construction of your site routes.
  • Parse Markdown and other formats supported by Pandoc / MMark.
  • Remain as simple as possible to use
  • Reproducible and a delightful workflow enabled by Nix, ghcid and fsnotify.

See Quick Preview# to get a feel for what your code may look like.

Getting Started

The easiest way to get started with Rib is to use the template repository, rib-sample, from Github.

Next

\ No newline at end of file +Rib

Rib

Rib is a Haskell static site generator based on Shake, with a delightful development experience.

Features

Rib composes existing tools designed to do their task well, instead of reinventing their capabilities. Time spent using rib is time spent learning them.

  • Use Shake as the core build engine.
  • Write HTML & CSS in Haskell with natural flow (using Lucid & Clay)
    • Optional route system for type-safe construction of your site routes.
  • Parse Markdown and other formats supported by Pandoc / MMark.
  • Remain as simple as possible to use
  • Reproducible and a delightful workflow enabled by Nix, ghcid and fsnotify.

See Quick Preview# to get a feel for what your code may look like.

Getting Started

The easiest way to get started with Rib is to use the template repository, rib-sample, from Github.

Next

\ No newline at end of file diff --git a/preview.html b/preview.html index 4157494..d95b990 100644 --- a/preview.html +++ b/preview.html @@ -94,4 +94,4 @@ data SrcMeta -- | Description is optional, hence `Maybe` description :: Maybe Text } - deriving (Show, Eq, Generic, FromJSON)

(View full Main.hs at rib-sample)

\ No newline at end of file + deriving (Show, Eq, Generic, FromJSON)

(View full Main.hs at rib-sample)

\ No newline at end of file diff --git a/syntax-highlighting.html b/syntax-highlighting.html index a8a238a..6a52794 100644 --- a/syntax-highlighting.html +++ b/syntax-highlighting.html @@ -1 +1 @@ -Enable Syntax Highlighting - Rib

Enable Syntax Highlighting

Use Pandoc to add syntax highlighting support to your rib site.

  1. Import the desired style from Pandoc

    import Text.Pandoc.Highlighting (styleToCss, tango)
  2. Add it to the <head> section of your HTML:

    style_ [type_ "text/css"] $ styleToCss tango
  3. Make sure that your Markdown files specify the language in their fenced code blocks. See Github documentation for details.

\ No newline at end of file +Enable Syntax Highlighting - Rib

Enable Syntax Highlighting

Use Pandoc to add syntax highlighting support to your rib site.

  1. Import the desired style from Pandoc

    import Text.Pandoc.Highlighting (styleToCss, tango)
  2. Add it to the <head> section of your HTML:

    style_ [type_ "text/css"] $ styleToCss tango
  3. Make sure that your Markdown files specify the language in their fenced code blocks. See Github documentation for details.

\ No newline at end of file diff --git a/tutorial.html b/tutorial.html index dfa54e3..3e016ed 100644 --- a/tutorial.html +++ b/tutorial.html @@ -2,4 +2,4 @@ ... $ cd mysite $ ls -F -content/ default.nix Main.hs README.md rib-sample.cabal

The three key items here are:

  1. Main.hs: Haskell source containing the DSL of the HTML/CSS of your site. See Quick Preview.
  2. content/: The source content (eg: Markdown sources and static files)
  3. dest/: The target directory, excluded from the git repository, will contain generated content (i.e., the HTML files, and copied over static content)

The template repository comes with a few sample posts under content/, and a basic HTML layout and CSS style defined in Main.hs.

Run the site

Now let’s run them all.

Clone the sample repository locally, install Nix (as described in its README) and run your site as follows:

nix-shell --run 'ghcid -T ":main -wS"'

Running this command gives you a local HTTP server at http://127.0.0.1:8080 (serving the generated files) that automatically reloads when either the content (content/) or the HTML/CSS/build-actions (Main.hs) changes. Hot reload, in other words.

How Rib works

How does the aforementioned nix-shell command work?

  1. nix-shell will run the given command in a shell environment with all of our dependencies (notably the Haskell ones including the rib library itself) installed.

  2. ghcid will compile your Main.hs and run its main function.

  3. Main.hs:main in turn calls Rib.App.run which takes as argument your custom Shake action that will build the static site.

  4. Rib.App.run: this parses the CLI arguments and runs the rib CLI “app” which can be run in one of a few modes — generating static files, watching the content/ directory for changes, starting HTTP server for the dest/ directory. The “-wS” options will run the Shake build action passed as argument on every file change and spin up a HTTP server.

Run that command, and visit http://127.0.0.1:8080 to view your site.

Editing workflow

Now try making some changes to the content, say content/first-post.md. You should see it reflected when you refresh the page. Or change the HTML or CSS of your site in Main.hs; this will trigger ghcid to rebuild the Haskell source and restart the server.

What’s next?

Great, by now you should have your static site generator ready and running!

Rib recommends writing your Shake actions in the style of being forward-defined which adds to the simplicity of the entire thing.

\ No newline at end of file +content/ default.nix Main.hs README.md rib-sample.cabal

The three key items here are:

  1. Main.hs: Haskell source containing the DSL of the HTML/CSS of your site. See Quick Preview.
  2. content/: The source content (eg: Markdown sources and static files)
  3. dest/: The target directory, excluded from the git repository, will contain generated content (i.e., the HTML files, and copied over static content)

The template repository comes with a few sample posts under content/, and a basic HTML layout and CSS style defined in Main.hs.

Run the site

Now let’s run them all.

Clone the sample repository locally, install Nix (as described in its README) and run your site as follows:

nix-shell --run 'ghcid -T ":main -wS"'

Running this command gives you a local HTTP server at http://127.0.0.1:8080 (serving the generated files) that automatically reloads when either the content (content/) or the HTML/CSS/build-actions (Main.hs) changes. Hot reload, in other words.

How Rib works

How does the aforementioned nix-shell command work?

  1. nix-shell will run the given command in a shell environment with all of our dependencies (notably the Haskell ones including the rib library itself) installed.

  2. ghcid will compile your Main.hs and run its main function.

  3. Main.hs:main in turn calls Rib.App.run which takes as argument your custom Shake action that will build the static site.

  4. Rib.App.run: this parses the CLI arguments and runs the rib CLI “app” which can be run in one of a few modes — generating static files, watching the content/ directory for changes, starting HTTP server for the dest/ directory. The “-wS” options will run the Shake build action passed as argument on every file change and spin up a HTTP server.

Run that command, and visit http://127.0.0.1:8080 to view your site.

Editing workflow

Now try making some changes to the content, say content/first-post.md. You should see it reflected when you refresh the page. Or change the HTML or CSS of your site in Main.hs; this will trigger ghcid to rebuild the Haskell source and restart the server.

What’s next?

Great, by now you should have your static site generator ready and running!

Rib recommends writing your Shake actions in the style of being forward-defined which adds to the simplicity of the entire thing.

\ No newline at end of file diff --git a/typed-routes.html b/typed-routes.html index 38b97dc..f1fe01a 100644 --- a/typed-routes.html +++ b/typed-routes.html @@ -6,4 +6,4 @@ Route_Home -> pure "index.html" Route_Article srcPath -> - pure $ "article" </> srcPath -<.> ".html"

Notice how in order to calculate the file path of a route, you only need the route (Route a), but not the data (a) used to generate it.

The arguments your route constructors take are meant to be used in the calculation of this file path. For example, the FilePath argument of the Route_Article constructor specifies the source path of the Markdown document, from which we compute the target (generated) path by simply replacing the extension with “.html” (in addition to putting it in a sub directory “article”).

Generating a route

Rib.Route.writeRoute takes a route, a string and writes that string to the file path associated with the route. You will use this in your Shake Action monad, typically inside a forEvery block.

Route URLs

Once routes are fully defined as above, it becomes very straightforward to use them when linking in your HTML. The Rib.routeUrl function takes a route (Route a) and returns the URL to that route.

You will pass your routes to whichever function (renderPage is principle among them) that needs to know the URL to your generated files, as long as they remain polymorphic in the route type.

See also

\ No newline at end of file + pure $ "article" </> srcPath -<.> ".html"

Notice how in order to calculate the file path of a route, you only need the route (Route a), but not the data (a) used to generate it.

The arguments your route constructors take are meant to be used in the calculation of this file path. For example, the FilePath argument of the Route_Article constructor specifies the source path of the Markdown document, from which we compute the target (generated) path by simply replacing the extension with “.html” (in addition to putting it in a sub directory “article”).

Generating a route

Rib.Route.writeRoute takes a route, a string and writes that string to the file path associated with the route. You will use this in your Shake Action monad, typically inside a forEvery block.

Route URLs

Once routes are fully defined as above, it becomes very straightforward to use them when linking in your HTML. The Rib.routeUrl function takes a route (Route a) and returns the URL to that route.

You will pass your routes to whichever function (renderPage is principle among them) that needs to know the URL to your generated files, as long as they remain polymorphic in the route type.

See also

\ No newline at end of file