I've been through the links on orgmode.com about doing this, but there's still something missing about it for me.
Jekyll posts and pages begin with YAML frontmatter. This is placed in
the .org file with #+BEGIN_HTML
/ #+END_HTML
guards. That limits me
to sub-editing that section (with C-c '
) in html-mode
. I can't switch
to yaml-mode
and back to html-mode
to edit it as YAML, though, as it
somehow loses context and can't switch out of the sub-edit mode.
Is there some way to do what I wish, i.e. edit the frontmatter in YAML mode?
File 1-with-html.org-raw
shows what one is "supposed" to do, place the
frontmatter ins the html block, and this renders exactly as I'd prefer
it, but doesn't let me edit the content in yaml-mode
, only
html-mode
. This renders out correctly with running jekyll build
.
File 4-with-yaml.org-raw
shows what was suggested, with a src block
for yaml text, and using the :results html
flag. This ends up
causing the block's content to be rendered in markdown as a verbatum
block, i.e., pushed to the right 4 spaces. That causes problems when
run through jekyll, as it renders the frontmatter as content.
What I need is for that source YAML block to be rendered just as is,
i.e. copied directly without changes at all. The initial suggestion to
add :result html
did not do as I'd hoped, sadly.
From user Left Right on the G+ Emacs community, I got the direction and help I need to make this work. The final answer was to tell babel how to execute YAML source:
(defun org-babel-execute:yaml (body params) body)
Now I have the output I want.
Trying with
#+begin_src yaml :exports results :results value html
resulted in no frontmatter at all in the markdown file5-with-yaml.md-raw