Indented source block
tags: indented lists code-fence src-block
Description/Summary
Test that indented source blocks, and also the ones in lists export fine.Content
Some content.
(defun small-shell ()
(interactive)
(split-window-vertically)
(other-window 1)
(shrink-window (- (window-height) 12))
(ansi-term))
Code blocks in list using code fences #
Reference: hugo
Issue #4006
-
List item 1
(message "I am in list at level-1 indentation")
-
List item 1.1
(message "I am in list at level-2 indentation")
- List item 1.1.1
(message "I am in list at level-3 indentation")
- List item 1.1.1
-
List item 2.1
(message "I am in list back at level-2 indentation")
-
-
List item 2
(message "I am in list back at level-1 indentation")
(message "And now I am at level-0 indentation")
Code blocks in list using highlight
shortcode
#
Reference: hugo
Issue #4717, ox-hugo
Issue #161
Switched from exporting the highlight
shortcode to exporting the
code fenced blocks with attributes. These code fences are support by
Hugo + Goldmark since v0.60.0.
Below notes are now outdated and thus grayed out.
This is an upstream bug in hugo
as of 2018-05-12. The issue is
that when the code blocks in highlight
shortcodes are inserted at
the required indentation levels in lists.. so that they get rendered
in the list at that indentation level, those indentations are not
removed by hugo
, and thus become part of those code blocks.
Also, related to this issue, it can be seen that all such indented code blocks have an empty second line too, probably just due to the unremoved indentation on the last line of those code blocks.
In the above section, the same code blocks are code-fenced instead of
using highlight
shortcode, and the extra indentation is not seen
there.
-
List item 1
1
(message "I am in list at level-1 indentation")
-
List item 1.1
1
(message "I am in list at level-2 indentation")
- List item 1.1.1
1
(message "I am in list at level-3 indentation")
- List item 1.1.1
-
List item 2.1
1
(message "I am in list back at level-2 indentation")
-
-
List item 2
1
(message "I am in list back at level-1 indentation")
|
|
Page (Debug)
Page Variable | Value | |
---|---|---|
Name | "Indented source block" | |
Title | "Indented source block" | |
ResourceType | "page" | |
Kind | "page" | |
Section | "posts" | |
Draft | false | |
Type | "posts" | |
Layout | "" | |
Permalink | "https://ox-hugo.scripter.co/test/posts/source-block-indented/" | |
RelPermalink | "/posts/source-block-indented/" | |
Data |
| |
NextPage | Indented equations block | |
PrevPage | Inheriting tags | |
NextInSection | Indented equations block | |
PrevInSection | Inheriting tags |
Page Params (Debug)
Key | Type | Value |
---|---|---|
description | string | " Test that indented source blocks, and also the ones in lists export\n fine.\n " |
draft | bool | false |
iscjklanguage | bool | false |
lastmod | time.Time | 2022-05-27 10:36:55 -0400 -0400 |
tags | []string | "indented" "lists" "code-fence" "src-block" |
title | string | "Indented source block" |
File Object (Debug)
FileInfo Variable | Value |
---|---|
UniqueID | "fea1fa81e4c53d84cef5fc4eb01f2b40" |
BaseFileName | "source-block-indented" |
TranslationBaseName | "source-block-indented" |
Lang | "en" |
Section | "posts" |
LogicalName | "source-block-indented.md" |
Dir | "posts/" |
Ext | "md" |
Path | "posts/source-block-indented.md" |