Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BEGIN_SRC in footnote exports verbatim #433

Closed
winny- opened this issue Mar 21, 2021 · 4 comments
Closed

BEGIN_SRC in footnote exports verbatim #433

winny- opened this issue Mar 21, 2021 · 4 comments

Comments

@winny-
Copy link
Contributor

winny- commented Mar 21, 2021

Actual Behavior

The footnote is exported with the BEGIN_SRC verbatim.

Expected Behavior

The footnote is exported with a markdown code block.

I tried editing the resulting md document so the multi-line code block appears in the footnote, but hugo appears to move the block to the bottom of the post's body. Could this be a hugo limitation? In contrast, the Org HTML Export appears to allow code blocks in footnotes.

How to Reproduce the Issue

hugo new site testsite .
cd testsite
mkdir -p content-org
emacs  # Create the org file below and run C-c C-e H A
# add a theme and serve the site to inspect

Example Org File

#+hugo_base_dir: ..
#+startup: indent
* Test post
:PROPERTIES:
:EXPORT_FILE_NAME: test-post
:END:
Testing code in a footnote with a  =BEGIN_SRC= directive.[fn:1]

* Footnotes

[fn:1] 
#+BEGIN_SRC elisp
(emacs-version)
#+END_SRC

Generated Markdown File or Error

+++
title = "Test post"
draft = false
+++

Testing code in a footnote with a  `BEGIN_SRC` directive.[^fn:1]

[^fn:1]: \#+BEGIN\_SRC elisp (emacs-version) \#+END\_SRC

Ox-Hugo Debug Information

Debug Info

Debug information for ox-hugo

Emacs Version

GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2021-03-09

Org Version

Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/26.3/lisp/org/)

Hugo Version

Hugo Static Site Generator v0.78.1/extended linux/amd64 BuildDate: unknown

Org load-path shadows

Warning: Possible mixed installation of Org

~/.emacs.d/org-static-blog/org-static-blog hides /home/winston/.emacs.d/elpa/org-static-blog-20210306.1316/org-static-blog

Study the output of M-x list-load-path-shadows.

ox-hugo defcustoms

org-hugo-section "posts"
org-hugo-use-code-for-kbd nil
org-hugo-preserve-filling t
org-hugo-delete-trailing-ws t
org-hugo-prefer-hyphen-in-tags t
org-hugo-allow-spaces-in-tags t
org-hugo-tag-processing-functions (org-hugo–tag-processing-fn-replace-with-spaces-maybe org-hugo–tag-processing-fn-replace-with-hyphens-maybe)
org-hugo-auto-set-lastmod nil
org-hugo-export-with-toc nil
org-hugo-export-with-section-numbers nil
org-hugo-front-matter-format "toml"
org-hugo-default-static-subdirectory-for-externals "ox-hugo"
org-hugo-external-file-extensions-allowed-for-copying ("jpg" "jpeg" "tiff" "png" "svg" "gif" "mp4" "pdf" "odt" "doc" "ppt" "xls" "docx" "pptx" "xlsx")
org-hugo-date-format "%Y-%m-%dT%T%z"
org-hugo-paired-shortcodes ""
org-hugo-langs-no-descr-in-code-fences nil
org-hugo-suppress-lastmod-period 0.0
org-hugo-front-matter-format "toml"
@kaushalmodi
Copy link
Owner

Thanks for reporting this. While I don't see the exported Markdown as seen by you, I see that the exported Markdown is not correct for code blocks in footnotes.. I see:

[^fn:1]: ```elisp (emacs-version) ```

I don't know if Hugo/CommonMark would support code blocks in foot-notes.. This will need to be investigated.

@kaushalmodi
Copy link
Owner

@winny- I just tested this out locally.. it's not possible to support source blocks (or any multi-line element) in the footnotes as Hugo doesn't support multi-line content in footnotes. I have added your test case to the ox-hugo test suite to demonstrate that: https://ox-hugo.scripter.co/test/issues/443-src-block-in-footnote/

@kaushalmodi
Copy link
Owner

@winny- Please bring this up on Hugo Discourse. Active users there might have ideas on how to make this work. If you can come up with a Markdown file that shows the source code formatting correctly in footnotes, I can work to make ox-hugo export in that format.

@quantumgc
Copy link

Hugo now supports Goldmark by default which uses a different footnote backend, specifically php-markdown's footnote extension. This supports multi-line footnotes. Copying the example on the PHP-markdown page,

That's some text with a footnote.[^1]

[^1]: And that's the footnote.

    That's the second paragraph.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants