⚒Anvil
Sign in

clo / cl-site public

closed

Support Markdown as input format 9

opened by common-lisp.net

Administrator (@root) on GitLab, 2018-10-06.

One of the libraries we might want to use to do so: https://github.com/orthecreedence/markdown.cl

Pages where this makes sense are those which are supposed to change regularly. Using Markdown makes changing the site more inviting.

Ccommon-lisp.net

Erik Huelsmann (@ehuelsmann) on GitLab, 2018-10-11.

1788e26acf64e9ea06a0a3abb00571e6018f1d85 added generation of the News page from markdown.

Ccommon-lisp.net

Erik Huelsmann (@ehuelsmann) on GitLab, 2018-10-11.

The next step would be to iterate over all Markdown input files and generate HTML fragments from them which are then included in the standard layout.

common-lisp.net mentioned in issue #14
common-lisp.net changed milestone to %1
Ccommon-lisp.net

Dave Cooper (@dcooper) on GitLab, 2018-10-12.

I see news.md is being processed with the generate-news function in process.lisp. There are also companies.md and libraries.md. How did those get converted to html, manually?

So right now I'm gonna try to make something which goes before the (generate-news) in process-pages to iterate through all the content/*.md files, and generate corresponding .html files for them...

Ccommon-lisp.net

Administrator (@root) on GitLab, 2018-10-12.

Yes, the others have been manually processed. I'd like that to be no longer the case as it's in my opinion the primary purpose of having the site builder software.

Ccommon-lisp.net

Administrator (@root) on GitLab, 2018-10-12.

I think that having something before (generate-news) is the the way to go indeed.

Ccommon-lisp.net

Dave Cooper (@dcooper) on GitLab, 2018-10-12.

@root How did you generate lisp-companies.html and libraries.html from the respective .md files?

I tried the :markdown.cl as you're using now for the news, and it throws an error because of the existing HTML stuff at the top of libraries.md.

I also tried :cl-markdown, which deals with the existing HTML ok, but doesn't seem to handle the ! before [] for URLs, nor format the table of contents. Both these files refer to using M-x markdown-toc-refresh-toc or M-x markdown-toc-generate-toc -- so apparently they expect some kind of emacs-based markdown parser?

It also looks like the content in those .md files is slightly different from the .html files -- did you make some changes to the HTML by hand after generating?

If it's not straightforward to parse the lisp-companies.md and libraries.md, maybe we can skip those two for now and start converting to .md for the other (simpler) content files?

Ccommon-lisp.net

Administrator (@root) on GitLab, 2018-10-12.

I personally didn't generate the html files from the md files, but the person who did, used pandoc.

Ccommon-lisp.net

Dave Cooper (@dcooper) on GitLab, 2018-10-13.

@root, ok, it looks like they did something fancy and/or manual with using pandoc, because I can't get the exact .html out of those .md files, e.g. the title is different, there are extra image links at the top, the table of contents div has a class so that our styling puts it into a sidebar. Is it possible to contact the person who did this and request a bit more hand-holding to get us started? I guess our intention is to "fork" from the original sources of the Company and Libraries list, and start maintaining those ourselves?

For the other files which are currently in raw HTML, how do you envision the markdown support to work? One .md file per current .html file, or something finer-grained than that? (you mentioned "fragments"). Ultimately, I wouldn't mind getting all our HTML into LHTML format, and use Markdown within that for chunks of the actual text content. Then we can use a combination of cl-who and cl-markdown (or markdown.cl) in order to render these into HTML (this is exactly what we do currently for genworks.com -- we wrap the markdown-formatted text with a with-markdown macro which runs markdown:markdown over it and wraps it in a cl-who str).

It looks like pandoc has ability to convert from .md back to .html - but some things may be lost in the process. Do you think it will make sense to try to auto-convert our current .html files back to .md, and go from there? Or maybe just do that for blocks of actual text content? In the end I think it will be good if we can avoid having special-purpose functions in processor.lisp which keep track of custom HTML to be interspersed in particular files, as is currently there for news.md -> news.html.

Ccommon-lisp.net

Erik Huelsmann (@ehuelsmann) on GitLab, 2018-10-13.

@dcooper, what I could find regarding the generation of the current html files is: https://gitlab.common-lisp.net/vdardel/cl-site/commit/049ce796f9f66855be6d581e14787069ba7fa158

Ccommon-lisp.net

Erik Huelsmann (@ehuelsmann) on GitLab, 2018-10-13.

is there anything I can look at, possibly improve on, regarding your processing of markdown files? Maybe there's a quick fix for the double images etc.

Ccommon-lisp.net

Dave Cooper (@dcooper) on GitLab, 2018-10-13.

@root I'm leaving the lisp-companies.html and libraries.html alone for now.

What I did was add ability to author our own pages with a combination of lhtml and markdown, with about.html as the first reference example (now replaced with about.lisp).

There are a couple slight conflicts with my merge request - can you resolve those? (I need to improve my git skills a bit to figure how how to keep my (forked) working branch up to date with its origin, before committing and submitting the merge request, sorry for that...)

Ccommon-lisp.net

Dave Cooper (@dcooper) on GitLab, 2018-10-13.

@root Ok I just re-submitted the merge request which apparently now is free of conflicts, and it passed the pipeline in my fork.

Ccommon-lisp.net

Dave Cooper (@dcooper) on GitLab, 2018-10-14.

Ok, hopefully third time's a charm. Just re-submitted a new merge request !48 which should take care of the missing about.html, and reverts :cl-markdown to :markdown.cl. After this has been merged and seen to be stable, news.html can be retrofitted to a news.lisp which will collapse down the generate-news function because it will only have to do the generate-news-box portion.

Ccommon-lisp.net

Erik Huelsmann (@ehuelsmann) on GitLab, 2018-10-14.

test reply

Ccommon-lisp.net

Erik Huelsmann (@ehuelsmann) on GitLab, 2018-10-14.

@dcooper

I also tried :cl-markdown, which deals with the existing HTML ok, but doesn't seem to handle the ! before [] for URLs

the exclamation mark before [] is for images, I think. Could you push your efforts to a branch somewhere so we can build on your experience?

nor format the table of contents

cl-markdown seems to have an extension which generates a ToC. Maybe it's just a matter of programming (CSS) to format it "correctly"?

common-lisp.net mentioned in merge request !54
Ccommon-lisp.net

Erik Huelsmann (@ehuelsmann) on GitLab, 2018-10-20.

@mmontone, could you help out with the markdown branch? It contains a few commits we need to migrate some content to use Markdown. (No need to convert everything to markdown, really, at least not yet anyway.)

There's one important bit missing though: the table-of-content generator. I'm thinking you can do something like the the news-box generator for that too, I hope?

Ccommon-lisp.net

Erik Huelsmann (@ehuelsmann) on GitLab, 2018-10-20.

Or maybe we can just tweak our CSS so that it produces the same layout as the current table-of-content, but then for the HTML as generated by cl-markdown.

Ccommon-lisp.net

Mariano Montone (@mmontone) on GitLab, 2018-10-20.

Ok. I'll have a look.

common-lisp.net closed via merge request !54
common-lisp.net mentioned in commit 8fa6d5e6155a9d079d65bef9118d99ea807910d8

Sign in to comment.