[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ANN] guile-commonmark 0.1 (A markdown parser)
From: |
Erik Edrosa |
Subject: |
Re: [ANN] guile-commonmark 0.1 (A markdown parser) |
Date: |
Mon, 25 Jul 2016 20:58:25 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 |
On 07/25/2016 09:44 AM, Thompson, David wrote:
> On Sun, Jul 24, 2016 at 10:33 PM, Erik Edrosa <address@hidden> wrote:
>>
>> As a bonus for haunt users, here is an example using guile-commonmark as
>> a reader to generate a blog written in markdown.
>>
>> (use-modules (haunt asset)
>> (haunt builder blog)
>> (haunt builder atom)
>> (haunt reader)
>> (haunt site)
>> (haunt post)
>> (commonmark))
>>
>> (define commonmark-reader
>> (make-reader (make-file-extension-matcher "md")
>> (lambda (file)
>> (call-with-input-file file
>> (lambda (port)
>> (values (read-metadata-headers port)
>> (commonmark->sxml port)))))))
>>
>> (site #:title "Built with Guile"
>> #:domain "example.com"
>> #:default-metadata
>> '((author . "Eva Luator")
>> (email . "address@hidden"))
>> #:readers (list commonmark-reader)
>> #:builders (list (blog)
>> (atom-feed)
>> (atom-feeds-by-tag)))
>>
>> Now just save the above as haunt.scm and put your markdown blog posts in
>> the posts directory with a .md extension and run `haunt build`. Here is
>> an example blog post:
>>
>> title: Hello World!
>> date: 2016-07-24 10:00
>> tags: guile, commonmark, scheme
>> ---
>>
>> A CommonMark Document
>> ===============
>> Here is some *scheme* `code`
>> ```scheme
>> (display "Hello, World!")
>> ```
>>
>> 1. A list
>> 2. Another item in a list
>>
>> Read more about [CommonMark](http://commonmark.org/)
>>
>>
>> Please note the header on top portion of the post which allows you to
>> add metadata to your blog posts for haunt.
>
> This is just wonderful! Thank you!
>
> If you have the time/motivation, I would love to see a patch to Haunt
> itself that adds guile-commonmark as an optional dependency. There's
> prior art for this because guile-reader is also optional, so it would
> mostly be a copy/paste job in configure.ac and Makefile.am to
> conditionally include the markdown reader module in the list of source
> modules.
>
> - Dave
>
Definitely, I have been playing around with haunt and managed to switch
my current blog to use haunt and guile-commonmark. I have a couple of
ideas to add to haunt, so I will hopefully be sending you some patches soon.
Thanks,
Erik