joshed-io / reveal-hugo

📽️ Create rich HTML-based presentations with Hugo and Reveal.js
https://reveal-hugo.dzello.com/
MIT License
690 stars 146 forks source link

[Feature request]: support for org-mode #72

Open prosoitos opened 4 years ago

prosoitos commented 4 years ago

Hi!

Through go-org, Hugo has native support for org-mode and it works really well with all themes, except for reveal-hugo since reveal-hugo is a bit of a special theme, with idiosyncratic syntax such as the slide separator ---.

Would it be possible to make reveal-hugo accept org-mode as content format?

Thank you!!!

joshed-io commented 4 years ago

Thanks for starting the conversation. Did you give it a try already and see some errors?

prosoitos commented 4 years ago

For now, all my attempts have lead to empty html files.

But there are many things in the files front matter that I don't know how to write, so I am probably not writing them properly. If you have suggestions on what the proper syntax might look like, I would be happy to try!

As an example, here is what my .md front matter looks like for one file:

+++
title = "cli_tools"
outputs = ["Reveal"]
[logowg]
src = "/img/wg_white_removed_medium.png"
alt = "WestGrid logo"
[logocc]
src = "/img/cc_regional_partner_brown_large.png"
alt = "Compute Canada logo"
[reveal_hugo]
custom_theme = "mh.scss"
custom_theme_compile = true
+++

I know that the +++ have to be removed and that

title = "cli_tools"

should be replaced by

#+title: cli_tools

But for lines such as outputs = ["Reveal"] or [reveal_hugo], I am not sure how to convert them.

prosoitos commented 4 years ago

In a different site with another theme, I successfully converted my .md files to .org files by replacing, for instance, this front matter:

+++
title = "Introduction to Julia programming language"
slug = "julia"
description = "3h workshop intro to Julia at SFU"
tags = ["julia", "hpc", "programming"]
categories = ["workshop"]
date = "2020-03-03"
toc = true
+++

with this one:

#+title: Introduction to Julia programming language
#+slug: julia
#+description = 3h workshop intro to Julia at SFU
#+tags[]: julia hpc programming
#+categories[]: workshop
#+date: 2020-03-03

#+OPTIONS: toc:1
prosoitos commented 4 years ago

Following this format, it looks like outputs = ["Reveal"] should be changed to #+outputs[]: Reveal, though I am not certain.

But I don't know what to do with [logowg] or [reveal_hugo].

If those get written properly, who knows: things might work.

Kaligule commented 1 year ago

I wrote up two code points where I think the assumption of "everything is markdown, not org-mode" might have been baked into the code. Perhaps those might be a good starting point,

testing for the filename

{{- if ne $.Page.File.LogicalName "_index.md" -}}

https://github.com/dzello/reveal-hugo/blob/master/layouts/shortcodes/slide.html#L28

using a markdown-specific render function

The documentation for markdownify says you should use renderstring instead.

https://github.com/dzello/reveal-hugo/blob/master/layouts/shortcodes/slide.html#L10

{{- $html := $markdownContent | markdownify -}}