.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 63084bf "feat: Export info: links for Org manual to https://orgmode.org URLs" on 2022-04-15.
Markdown source of this page

Coderef

tags: src-block coderef annotation example-block


Description/Summary

Support anchoring the source and example block lines using Org coderef links.

Content

See Org Info: Literal Examples.

In literal examples, Org interprets strings like (ref:name) as labels, and use them as targets for special hyperlinks like [[(name)]] — i.e., the reference name enclosed in single parenthesis.

Line numbers are always enabled if coderefs are used. The code blocks are exported as if the user always added the -n switches to the source or example block header.

Source block #

Default line nums with coderef labels #

1
2
(save-excursion                 (sc)
   (goto-char (point-min))      (jump)

In line sc we remember the current position. Line jump jumps to point-min.

Default line nums without coderef labels #

1
2
(save-excursion
   (goto-char (point-min))

In line 1 we remember the current position. Line 2 jumps to point-min.

Custom line nums without coderef labels #

20
21
(save-excursion
   (goto-char (point-min))

In line 20 we remember the current position. Line 21 jumps to point-min.

Custom line nums without coderef labels and with highlighting #

20
21
(save-excursion
   (goto-char (point-min))

Line 21 jumps to point-min.

Reference to lines before code block #

In line 1 we remember the current position. Line 2 jumps to point-min.

1
2
(save-excursion
   (goto-char (point-min))

Example block #

20
21
(save-excursion
   (goto-char (point-min))

Line 21 jumps to point-min.


Page (Debug)

Page VariableValue
Name "Coderef"
Title "Coderef"
ResourceType "page"
Kind "page"
Section "posts"
Draft false
Type "posts"
Layout ""
Permalink "https://ox-hugo.scripter.co/test/posts/coderef/"
RelPermalink "/posts/coderef/"
Data
page.Data{} (type:page.Data)
NextPageCode-fenced source blocks with backticks
PrevPageCustom Creator
NextInSectionCode-fenced source blocks with backticks
PrevInSectionCustom Creator

Page Params (Debug)

KeyTypeValue
descriptionstring " Support anchoring the source and example block lines using Org coderef\n links.\n "
draftbool false
iscjklanguagebool false
lastmodtime.Time 2022-04-15 20:11:05 -0400 -0400
tags[]string "src-block" "coderef" "annotation" "example-block"
titlestring "Coderef"

File Object (Debug)

FileInfo VariableValue
UniqueID "adf531b06430b06fecc3d358620219d3"
BaseFileName "coderef"
TranslationBaseName "coderef"
Lang "en"
Section "posts"
LogicalName "coderef.md"
Dir "posts/"
Ext "md"
Path "posts/coderef.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]