.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 efdf4c0 "Change `linenos` arg value to `true`; update tests" on 2022-03-08.
Markdown source of this page

Whitespace trimming around special blocks

tags: special-block whitespace trimming


Description/Summary

Whitespace trimming using ~#+header: :trim-pre t :trim-post t~ before special blocks.

Content

By default (in org-hugo-special-block-type-properties), the “mark” special block type has :trim-pre and :trim-post both set to t, because typically the <mark> is used to highlight words and phrases mid-sentence and we wouldn’t want to introduce a paragraph break before or after a <mark> element.

Whitespace trimmed before and after the mark special block (default) #

Below Org block:

line 1
#+begin_mark
abc def
#+end_mark
line 2

exports and renders as:

line 1 abc def line 2

Whitespace trimmed only before the mark special block #

Below Org block:

line 1
#+header: :trim-post nil
#+begin_mark
abc def
#+end_mark
line 2

exports and renders as:

line 1 abc def

line 2

Whitespace trimmed only after the mark special block #

Below Org block:

line 1
#+header: :trim-pre nil
#+begin_mark
abc def
#+end_mark
line 2

exports and renders as:

line 1

abc def line 2

No trimming #

Below Org block:

line 1
#+header: :trim-pre nil :trim-post nil
#+begin_mark
abc def
#+end_mark
line 2

exports and renders as:

line 1

abc def

line 2

Use <span> tag if trimming detected #

Below Org block:

line 1
#+begin_foo
abc def
#+end_foo
line 2

exports with <div> tags by default:

1
2
3
4
5
6
7
8
9
line 1

<div class="foo">

abc def

</div>

line 2

and renders as:

line 1

abc def

line 2

But if any of the trimming options are set in the header, it switches to using the <span> tag. So the below Org block:

line 1
#+header: :trim-pre t :trim-post t
#+begin_foo
abc def
#+end_foo
line 2

will export to:

1
line 1 <span class="foo">abc def</span> line 2

and render as:

line 1 abc def line 2


Page (Debug)

Page VariableValue
Name "Whitespace trimming around special blocks"
Title "Whitespace trimming around special blocks"
ResourceType "page"
Kind "page"
Section "posts"
Draft false
Type "posts"
Layout ""
Permalink "https://ox-hugo.scripter.co/test/posts/ws-trimming-around-special-blocks/"
RelPermalink "/posts/ws-trimming-around-special-blocks/"
Data
page.Data{} (type:page.Data)
NextPageVerse for indentation
PrevPageWhitespace trimming around special blocks (corner cases)
NextInSectionVerse for indentation
PrevInSectionWhitespace trimming around special blocks (corner cases)

Page Params (Debug)

KeyTypeValue
descriptionstring "Whitespace trimming using ~#+header: :trim-pre t :trim-post t~ before special blocks."
draftbool false
iscjklanguagebool false
lastmodtime.Time 2022-03-08 20:49:23 -0500 -0500
tags[]string "special-block" "whitespace" "trimming"
titlestring "Whitespace trimming around special blocks"

File Object (Debug)

FileInfo VariableValue
UniqueID "d891d58d0756ca97849b4c066d438a3d"
BaseFileName "ws-trimming-around-special-blocks"
TranslationBaseName "ws-trimming-around-special-blocks"
Lang "en"
Section "posts"
LogicalName "ws-trimming-around-special-blocks.md"
Dir "posts/"
Ext "md"
Path "posts/ws-trimming-around-special-blocks.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]