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
-nswitches to the source or example block header.
Source block #
Default line nums with coderef labels #
In line sc we remember the current position. Line jump jumps to point-min.
Default line nums without coderef labels #
In line 1 we remember the current position. Line 2 jumps to point-min.
Custom line nums without coderef labels #
In line 20 we remember the current position. Line 21 jumps to point-min.
Custom line nums without coderef labels and with highlighting #
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.
Example block #
Line 21 jumps to point-min.
Page (Debug)
| Page Variable | Value | |
|---|---|---|
| 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 |
| |
| NextPage | Code-fenced source blocks with backticks | |
| PrevPage | Custom Creator | |
| NextInSection | Code-fenced source blocks with backticks | |
| PrevInSection | Custom Creator |
Page Params (Debug)
| Key | Type | Value |
|---|---|---|
| description | string | " Support anchoring the source and example block lines using Org coderef\n links.\n " |
| draft | bool | false |
| iscjklanguage | bool | false |
| lastmod | time.Time | 2022-04-15 20:11:05 -0400 -0400 |
| tags | []string | "src-block" "coderef" "annotation" "example-block" |
| title | string | "Coderef" |
File Object (Debug)
| FileInfo Variable | Value |
|---|---|
| UniqueID | "adf531b06430b06fecc3d358620219d3" |
| BaseFileName | "coderef" |
| TranslationBaseName | "coderef" |
| Lang | "en" |
| Section | "posts" |
| LogicalName | "coderef.md" |
| Dir | "posts/" |
| Ext | "md" |
| Path | "posts/coderef.md" |