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:
|
|
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:
|
|
and render as:
line 1 abc def line 2
Page (Debug)
Page Variable | Value | |
---|---|---|
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 |
| |
NextPage | Verse for indentation | |
PrevPage | Whitespace trimming around special blocks (corner cases) | |
NextInSection | Verse for indentation | |
PrevInSection | Whitespace trimming around special blocks (corner cases) |
Page Params (Debug)
Key | Type | Value |
---|---|---|
description | string | "Whitespace trimming using ~#+header: :trim-pre t :trim-post t~ before special blocks." |
draft | bool | false |
iscjklanguage | bool | false |
lastmod | time.Time | 2022-03-08 20:49:23 -0500 -0500 |
tags | []string | "special-block" "whitespace" "trimming" |
title | string | "Whitespace trimming around special blocks" |
File Object (Debug)
FileInfo Variable | Value |
---|---|
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" |