.Kind (page): .Type (posts) / .Layout ()
Bundle: n/a (regular page)
[ categories | tags | search ]
ox-hugo Test Site

This is the test site for the ox-hugo package for Emacs/Org-mode.

It is updated automatically after each commit to the ox-hugo repo. It was last updated on Oct 05, 2024 21:20 UTC.


This page was created/modified in commit ace25a6 "fix: Don't add blank line after a code block followed by para either" on 2022-05-27.
Markdown source of this page

Code-fenced source blocks (default behavior)

tags: src-block code-fence


Description/Summary

The source blocks are code-fenced by default. Here are few variables that you might like to change in the local.mk: prefix Org installation directory prefix = /dir/where/you/want/to/install/org # Default: /usr/share The .el files will go to $(prefix)/emacs/site-lisp/org by default. If you’d like to change that, you can tweak the lispdir variable. infodir Org Info installation directory. I like to keep the Info file for development version of Org in a separate directory.


Content

The source blocks are code-fenced by default.

Here are few variables that you might like to change in the local.mk:

prefix
Org installation directory
prefix = /dir/where/you/want/to/install/org # Default: /usr/share

The .el files will go to $(prefix)/emacs/site-lisp/org by default. If you’d like to change that, you can tweak the lispdir variable.

infodir
Org Info installation directory. I like to keep the Info file for development version of Org in a separate directory.
infodir = $(prefix)/org/info # Default: $(prefix)/info
ORG_MAKE_DOC
Types of Org documentation you’d like to build by default.
# Define below you only need info documentation, the default includes html and pdf
ORG_MAKE_DOC = info pdf card # html
ORG_ADD_CONTRIB
Packages from the contrib/ directory that you’d like to build along with Org. Below are the ones on my must-have list.
# Define if you want to include some (or all) files from contrib/lisp
# just the filename please (no path prefix, no .el suffix), maybe with globbing
#   org-eldoc - Heading breadcrumb trail in minibuffer
#   ox-extra - Allow ignoring just the heading, but still export the body of those headings
#   org-mime - Convert org buffer to htmlized format for email
ORG_ADD_CONTRIB = org-eldoc ox-extra org-mime

Here’s an example of an emacs-lisp block:

(defvar emacs-version-short (format "%s_%s"
                                    emacs-major-version emacs-minor-version)
  "A variable to store the current emacs versions as <MAJORVER>_<MINORVER>.
So, for emacs version 25.0.50.1, this variable will be 25_0.")

Here’s an example of a python block (ox-hugo Issue #314):

import itertools as it
import numpy as np

def permanent(m):
    nr,nc = np.shape(m)
    if nr != nc:
        raise ValueError("Matrix must be square")
    pm = 0
    for p in it.permutations(range(nr)):
        pm += np.product([m[i,p[i]] for i in range(nr)])
   return pm

It is necessary to set the Hugo site config variable markup.highlight.codeFences to true (default) for syntax highlighting to work for fenced code blocks.


Page (Debug)

Page VariableValue
Name "Code-fenced source blocks (default behavior)"
Title "Code-fenced source blocks (default behavior)"
ResourceType "page"
Kind "page"
Section "posts"
Draft false
Type "posts"
Layout ""
Permalink "https://ox-hugo.scripter.co/test/posts/code-fenced-src-blocks-default/"
RelPermalink "/posts/code-fenced-src-blocks-default/"
Data
page.Data{} (type:page.Data)
NextPageSource block without list syntax in a list
PrevPageDon't Use Org Code markup for kbd tag
NextInSectionSource block without list syntax in a list
PrevInSectionDon't Use Org Code markup for kbd tag

Page Params (Debug)

KeyTypeValue
datetime.Time 2017-07-31 00:00:00 +0000 UTC
draftbool false
iscjklanguagebool false
lastmodtime.Time 2022-05-27 12:20:31 -0400 -0400
publishdatetime.Time 2017-07-31 00:00:00 +0000 UTC
tags[]string "src-block" "code-fence"
titlestring "Code-fenced source blocks (default behavior)"

File Object (Debug)

FileInfo VariableValue
UniqueID "c910d1a1056172fd1dc60aedf0a78586"
BaseFileName "code-fenced-src-blocks-default"
TranslationBaseName "code-fenced-src-blocks-default"
Lang "en"
Section "posts"
LogicalName "code-fenced-src-blocks-default.md"
Dir "posts/"
Ext "md"
Path "posts/code-fenced-src-blocks-default.md"

This site is generated using the ox-hugo package for Emacs/Org-mode + hugo-bare-min-theme + Hugo 0.101.0 (commit 466fa43c16709b4483689930a4f9ac8add5c9f66) . This site is powered by Netlify.
[Test Site home | ox-hugo home]