### Makefile Variables for Org Installation Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content-org/all-posts.org Shows examples of setting variables like 'prefix', 'infodir', 'ORG_MAKE_DOC', and 'ORG_ADD_CONTRIB' in a Makefile for Org installation and documentation. ```makefile prefix = /dir/where/you/want/to/install/org # Default: /usr/share ``` ```makefile infodir = $(prefix)/org/info # Default: $(prefix)/info ``` ```makefile # Define below you only need info documentation, the default includes html and pdf ORG_MAKE_DOC = info pdf card # html ``` ```makefile # Define if you want to include some (or all) files from contrib/lisp ``` -------------------------------- ### Install Pandoc binary from repository Source: https://github.com/kaushalmodi/ox-hugo/blob/main/CHANGELOG.org Installs the specified Pandoc binary from its repository, fixing issues related to dependency installation. ```bash install -d /tmp/${USER}/ox-hugo-dev cd /tmp/${USER}/ox-hugo-dev ``` -------------------------------- ### Serve Example Site with Make Source: https://github.com/kaushalmodi/ox-hugo/wiki/Example Hugo site.org Use this command to serve the example site locally. Requires Hugo 0.25+. ```bash make serve ``` -------------------------------- ### Add Real World Example Site Source: https://github.com/kaushalmodi/ox-hugo/blob/main/CHANGELOG.org Adds a specific real-world example site to the documentation. ```markdown https://zcl.space ``` -------------------------------- ### Enable Line Numbers with Default Start Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content/posts/example-block-with-line-numbers.md Use `linenos=true` and `linenostart=1` to enable line numbers starting from 1. This is useful for standard code examples. ```text line 1 line 2 ``` -------------------------------- ### Set Org Installation Directory (Makefile) Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content/posts/code-fenced-src-blocks-default.md Configure the installation directory for Org mode. The default is `/usr/share/`. ```makefile prefix = /dir/where/you/want/to/install/org # Default: /usr/share ``` -------------------------------- ### Continued Line Numbers in Example Block Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content-org/all-posts.org This example block demonstrates continued line numbering, starting from the previous number. ```org #+begin_example +n line 22 line 23 #+end_example ``` -------------------------------- ### Org Example Block with Custom Line Numbers and Highlighting Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content-org/all-posts.org This Org example block demonstrates custom line numbering starting from 20, reverse numbering, and highlighting line 2 using ':hl_lines 2'. ```org (save-excursion (goto-char (point-min)) (ref:jump5) ``` -------------------------------- ### Serve Example Site with Hugo CLI Source: https://github.com/kaushalmodi/ox-hugo/wiki/Example Hugo site.org Alternative method to serve the example site using the Hugo CLI. Requires Hugo 0.25+ for the --navigateToChanged flag. ```bash hugo server -D --navigateToChanged ``` -------------------------------- ### Add Real World Examples Source: https://github.com/kaushalmodi/ox-hugo/blob/main/CHANGELOG.org Introduces a section for real-world examples of ox-hugo usage, linking to a dedicated documentation page. ```markdown See https://ox-hugo.scripter.co/doc/examples/ ``` -------------------------------- ### Org Example Block with Line Numbers Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content-org/all-posts.org Demonstrates an Org example block with line number annotation enabled. The '-n' flag starts numbering from 1. ```org #+begin_example -n line 1 line 2 #+end_example ``` -------------------------------- ### Org Mode: List Value Front Matter Example Source: https://github.com/kaushalmodi/ox-hugo/blob/main/doc/ox-hugo-manual.org Provides examples of various list types (strings, integers, floats, booleans) configured via Org properties. ```org :PROPERTIES: :EXPORT_HUGO_CUSTOM_FRONT_MATTER: :animals '(dog cat "penguin" "mountain gorilla") :EXPORT_HUGO_CUSTOM_FRONT_MATTER+: :integers '(123 -5 17 1_234) :EXPORT_HUGO_CUSTOM_FRONT_MATTER+: :floats '(12.3 -5.0 -17E-6) :EXPORT_HUGO_CUSTOM_FRONT_MATTER+: :booleans '(true false) :END: ``` -------------------------------- ### Add Real World Example Site (Elisp) Source: https://github.com/kaushalmodi/ox-hugo/blob/main/CHANGELOG.org Adds a specific real-world example site related to Emacs Lisp. ```markdown https://cadadr.github.io/elisp/index.html ``` -------------------------------- ### Org Mode Gopher Link Example Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content/posts/external-links.md An example of how to write a gopher link in Org mode after the necessary Emacs Lisp configuration has been applied. ```org [[gopher://some.gopher.site][Dummy gopher link]] ``` -------------------------------- ### Basic Example Code Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content-org/all-posts.org A simple code line example, likely for testing purposes or as a placeholder. ```text code line ``` -------------------------------- ### Start Hugo Server for Live Preview Source: https://github.com/kaushalmodi/ox-hugo/wiki/Auto-export on Saving.org Run this command in your Hugo site's root directory to start the development server. The `-D` flag includes draft posts, and `--navigateToChanged` ensures the browser navigates to the changed post. ```bash hugo server -D --navigateToChanged ``` -------------------------------- ### Org-mode Directory Structure Example for Post 2 Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content-org/images-in-content/images-in-content.org Provides a file structure example specific to 'Post 2', highlighting the location of 'org.png' relative to the Org source file. This helps in understanding image path resolution for different posts. ```org ./content-org ├── images-in-content/ │ ├── images-in-content.org │ │ * Post 1 (Org subtree) → ./content/images-in-content/post1.md │ │ * Post 2 (Org subtree) → ./content/images-in-content/post2.md **THIS POST** │ ├── gnu.png → ./static/ox-hugo/gnu.png │ └── org.png → ./static/ox-hugo/org.png **BELOW IMAGE** ├── post3/ │ ├── post3.org → ./content/images-in-content/post3.md │ └── gnu-copy.png → ./static/ox-hugo/gnu-copy.png └── post4/ ├── post4.org → ./content/images-in-content/post4.md └── org-copy.png → ./static/ox-hugo/org-copy.png ``` -------------------------------- ### Example: Wrap Org Headings in HTML Tags Source: https://github.com/kaushalmodi/ox-hugo/blob/main/CHANGELOG.org Provides an example demonstrating how to wrap Org headings in HTML tags, addressing issue #160. ```emacs-lisp #+OPTIONS: toc:nil #+HUGO_CUSTOM_FRONT_MATTER: :PROPERTIES: :ID: wrap-org-headings-in-html-tags :END: * My Heading This is a test. #+begin_src elisp (setq org-hugo-wrap-heading-tags "
` tags or `` tags based on configuration.
```Org-mode
=~key-binding~=
```
```Markdown
`key-binding`
```
```Markdown
key-binding
```
--------------------------------
### Output with Specified Line Number Start
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content/posts/source-block-with-line-numbers.md
The output shows line numbers starting from the specified number when '-n ' is used in the Org source.
```emacs-lisp
;; this will export with line number 20
(message "This is line 21")
```
--------------------------------
### Org Source with Specified Line Number Start
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content/posts/source-block-with-line-numbers.md
Use '-n ' in Org source blocks to specify the starting line number for annotations.
```org
#+begin_src emacs-lisp -n 20
;; this will export with line number 20
(message "This is line 21")
#+end_src
```
--------------------------------
### Org Source Block with Highlighting and Line Numbers
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content-org/all-posts.org
An Org source block example that includes both syntax highlighting and line numbers.
```org
<>
```
--------------------------------
### Example Tags and Categories in #+filetags
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/doc/ox-hugo-manual.org
Demonstrates how to define tags and categories using the `#+filetags` keyword for file-based exports. Tags without the '@' prefix are treated as tags, while those with '@' are treated as categories.
```org
#+filetags: tag1 tag2 @cat1 @cat2
```
--------------------------------
### Common Menu Setting Style in Org
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/doc/ox-hugo-manual.org
Demonstrates a common way to set the 'menu' front-matter for a group of posts using Org property inheritance.
```org
,* Posts under the ~main~ Menu
:PROPERTIES:
:EXPORT_HUGO_MENU: :menu main
:END:
,** Post 1
:PROPERTIES:
:EXPORT_FILE_NAME: post-1
:END:
,** Post 2
:PROPERTIES:
:EXPORT_FILE_NAME: post-2
:END:
```
--------------------------------
### Python Print Statement Example
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content/posts/source-block-replace-langs-in-exported-md.md
A basic Python code snippet demonstrating a print statement. This example is useful for testing syntax highlighting and language identification in Markdown.
```python
(print "hello")
```
```python
(print "hello")
```
--------------------------------
### Hugo Figure Shortcode Example
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content/issues/470/index.md
Example of using the Hugo figure shortcode to embed an SVG with a link. Ensure the SVG does not contain a DOCTYPE tag for proper rendering.
```html
{{< figure src="https://user-images.githubusercontent.com/3578197/143625834-4548e998-0d45-4c9f-85bb-3d56456d3200.png" link="https://github.com/kaushalmodi/ox-hugo/issues/470#issuecomment-980385275" >}}
```
--------------------------------
### Org Source Block Highlighting With Line Numbers (Not Starting from 1)
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content-org/all-posts.org
An Org source block with highlighting and line numbers that do not start from 1. Uses `:noweb yes`.
```org
#+begin_src org :noweb yes
<>
#+end_src
```
```org
#+begin_src org :noweb yes :exports results :results output replace :eval yes
<>
#+end_src
```
--------------------------------
### Org-mode Directory Structure Example
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content-org/images-in-content/images-in-content.org
Illustrates the file structure for an Org-mode export, showing the relationship between Org source files, exported Markdown files, and image assets. This structure is relevant for understanding how relative image paths are resolved.
```org
./content-org
├── images-in-content/
│ ├── images-in-content.org
│ │ * Post 1 (Org subtree) → ./content/images-in-content/post1.md **THIS POST**
│ │ * Post 2 (Org subtree) → ./content/images-in-content/post2.md
│ ├── gnu.png → ./static/ox-hugo/gnu.png **BELOW IMAGE**
│ └── org.png → ./static/ox-hugo/org.png
├── post3/
│ ├── post3.org → ./content/images-in-content/post3.md
│ └── gnu-copy.png → ./static/ox-hugo/gnu-copy.png
└── post4/
├── post4.org → ./content/images-in-content/post4.md
└── org-copy.png → ./static/ox-hugo/org-copy.png
```
--------------------------------
### Example of Org Capture Output with CLOSED Property
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/doc/ox-hugo-manual.org
An example of an Org heading after being marked as DONE, showing the auto-inserted CLOSED timestamp property, which ox-hugo uses for the post date.
```org
,*** DONE Narrowing the Author column in Magit :org:log:
CLOSED: [2017-12-18 Mon 16:36]
```
--------------------------------
### Org Mode Source Block with Line Highlighting and Custom Start Line
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content-org/all-posts.org
Exports an Emacs Lisp source block with line highlighting, starting line numbering from 7.
```emacs-lisp
#+begin_src emacs-lisp -n 7 :hl_lines 1,3-5
(message "This is line 7 in code, but line 1 for highlighting reference")
(message "This is line 8 in code, but line 2 for highlighting reference")
(message "This is line 9 in code, but line 3 for highlighting reference")
(message "This is line 10 in code, but line 4 for highlighting reference")
(message "This is line 11 in code, but line 5 for highlighting reference")
(message "This is line 12 in code, but line 6 for highlighting reference")
#+end_src
```
--------------------------------
### Highlight Lines with Default Starting Line Number
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content/posts/source-block-with-highlighting-blackfriday.md
Enable line numbers for an Emacs Lisp code block and highlight specific lines, with line numbering starting from 1.
```org
#+begin_src emacs-lisp -n :hl_lines 1,3-5
(message "This is line 1")
(message "This is line 2")
(message "This is line 3")
(message "This is line 4")
(message "This is line 5")
(message "This is line 6")
#+end_src
```
```html
{{< highlight emacs-lisp "linenos=true, linenostart=1, hl_lines=1 3-5" >}}
(message "This is line 1")
(message "This is line 2")
(message "This is line 3")
(message "This is line 4")
(message "This is line 5")
(message "This is line 6")
{{< /highlight >}}
```
--------------------------------
### Generate Documentation Site
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/CONTRIBUTING.org
Run this command to generate Markdown files for the documentation site and .org files for GitHub. This is part of the documentation contribution workflow.
```shell
make doc
```
--------------------------------
### Hugo Highlight Shortcode with Specified Line Number Start
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content/posts/source-block-with-line-numbers-blackfriday.md
Represents the Hugo `highlight` shortcode for the previous Org mode block, setting line numbers to start from 20.
```html
{{< highlight emacs-lisp "linenos=true, linenostart=20" >}}
;; this will export with line number 20
(message "This is line 21")
{{< /highlight >}}
```
--------------------------------
### Neural Network Initialization and Training Execution
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content/real-examples/nn-intro.md
This snippet demonstrates how to initialize a Network object with specified layer sizes and then initiate the gradient descent training process using provided training and testing data. It assumes the existence of a `mnist_loader` module.
```python
if __name__ == '__main__':
import mnist_loader
train_data, valid_data, test_data = mnist_loader.load_data_wrapper()
net = Network([784, 100, 10])
net.gradient_descent(train_data, test_data, epoches=100, m=10, eta=2.0)
```
--------------------------------
### Org Source Block Highlighting With Line Numbers (Starting from 1)
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content-org/all-posts.org
This Org source block includes both highlighting and line numbers, with numbering starting from 1. Uses `:noweb yes`.
```org
#+begin_src org :noweb yes
<>
#+end_src
```
```org
#+begin_src org :noweb yes :exports results :results output replace :eval yes
<>
#+end_src
```
--------------------------------
### Build Markdown Tree with Make
Source: https://github.com/kaushalmodi/ox-hugo/wiki/Example Hugo site.org
Use this command to build the Markdown tree from an Org file. Specify the Org file using the ORG variable.
```bash
make mdtree ORG=content-org/all-posts.org
```
--------------------------------
### Wrap Debug Info in Org Example Blocks
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/CHANGELOG.org
Wraps debug information containing file paths in Org Example blocks to prevent forward slashes from being interpreted as Org italics.
```Emacs Lisp
;; Wrap the debug info containing file paths in Org Example blocks
;; That way the forward slashes in the paths don't get interpreted as Org
;; /italics/.
```
--------------------------------
### Org Special Block Example in Ox-Hugo
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/doc/ox-hugo-manual.org
Demonstrates the usage of Org Special Blocks in Ox-Hugo, similar to HTML and LaTeX export capabilities. This example shows how to mark text with custom delimiters.
```org
#+begin_mark
/Some/ *marked* text
#+end_mark
```
--------------------------------
### Resources in Front Matter (TOML)
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content-org/all-posts.org
Example of including resources within the front matter of a post, specifically configured for TOML export.
```org
:PROPERTIES:
:EXPORT_FILE_NAME: resources-in-front-matter-toml
:END:
```
--------------------------------
### Org Mode Source Block with Line Highlighting and Default Start Line
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content-org/all-posts.org
Exports an Emacs Lisp source block with line highlighting, using default line numbering starting from 1.
```emacs-lisp
#+begin_src emacs-lisp -n :hl_lines 1,3-5
(message "This is line 1")
(message "This is line 2")
(message "This is line 3")
(message "This is line 4")
(message "This is line 5")
(message "This is line 6")
#+end_src
```
--------------------------------
### Hugo Summary Splitter Example
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content-org/all-posts.org
Demonstrates the use of the '#+hugo: more' keyword to manually split content for summaries in Hugo. This is useful for controlling how much content appears before the 'read more' link.
```org
#+hugo: more
```
--------------------------------
### Linking to an Image in the Same Directory (Org-mode)
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content-org/images-in-content/images-in-content.org
Demonstrates how to link to an image file located in the same directory as the Org source file. This is a common scenario for including local assets.
```org
[[file:gnu.png]]
```
--------------------------------
### Highlight Lines with Custom Starting Line Number
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content/posts/source-block-with-highlighting-blackfriday.md
Configure highlighting for specific lines in an Emacs Lisp code block while also displaying line numbers that start from a custom number (e.g., 7).
```org
#+begin_src emacs-lisp -n 7 :hl_lines 1,3-5
(message "This is line 7 in code, but line 1 for highlighting reference")
(message "This is line 8 in code, but line 2 for highlighting reference")
(message "This is line 9 in code, but line 3 for highlighting reference")
(message "This is line 10 in code, but line 4 for highlighting reference")
(message "This is line 11 in code, but line 5 for highlighting reference")
(message "This is line 12 in code, but line 6 for highlighting reference")
#+end_src
```
```html
{{< highlight emacs-lisp "linenos=true, linenostart=7, hl_lines=1 3-5" >}}
(message "This is line 7 in code, but line 1 for highlighting reference")
(message "This is line 8 in code, but line 2 for highlighting reference")
(message "This is line 9 in code, but line 3 for highlighting reference")
(message "This is line 10 in code, but line 4 for highlighting reference")
(message "This is line 11 in code, but line 5 for highlighting reference")
(message "This is line 12 in code, but line 6 for highlighting reference")
{{< /highlight >}}
```
--------------------------------
### Generate Markdown and Documentation
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/CONTRIBUTING.org
Execute this command to generate both Markdown files for the documentation site and .org files. This is used when contributing to code.
```shell
make md doc
```
--------------------------------
### Render Markdown List in Code Block
Source: https://github.com/kaushalmodi/ox-hugo/blob/main/test/site/content-org/all-posts.org
Demonstrates rendering Markdown list syntax within an example block. This is a workaround for an upstream bug.
```markdown
- list 1
```
```example
- List item 1.1 in code block
- List item 1.2 in code block
```
```example
+ List item 2.1 in code block
+ List item 2.2 in code block
```
```example
- List item 1.1 in code block
- List item 1.2 in code block
```
```example
+ List item 2.1 in code block
+ List item 2.2 in code block
```