Skip to content

Commit 3179ae1

Browse files
author
Musa Al-hassy
committed
Add: Improve box docs
1 parent 7c0e104 commit 3179ae1

File tree

2 files changed

+36
-59
lines changed

2 files changed

+36
-59
lines changed

org-special-block-extras.org

Lines changed: 14 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3339,7 +3339,6 @@ Such “open methods” are known as “multimethods”; e.g., see doc:cl-defgen
33393339
:CUSTOM_ID: Folded-Details
33403340
:END:
33413341

3342-
33433342
# (setq osbe-example-yaml-cache (make-hash-table :test 'equal))
33443343
osbe-example:~/org-special-block-extras/tests/details.yaml
33453344

@@ -3435,23 +3434,15 @@ your Org file or place it into your ~org-html-head~ variable.
34353434
#+html: <style> summary:hover {background:pink;} </style>
34363435
#+end_box
34373436

3438-
* COMMENT Boxed Text
3437+
* DONE COMMENT Boxed Text —Calling out super duper info
34393438
:PROPERTIES:
34403439
:CUSTOM_ID: Boxed-Text
34413440
:END:
34423441

3443-
Folded regions, as implemented above, are displayed in a super neat text box
3444-
which may be useful to enclose text to make it standout ---without having it
3445-
folded away. As such, we provide the special block [[doc:org-block/box][box]] to enclosing text in
3446-
boxes.
3447-
3448-
#+latex_header: \usepackage{tcolorbox}
3449-
#+begin_center
3450-
Requires: src_latex[:exports code]{#+latex_header: \usepackage{tcolorbox}}
3451-
#+end_center
3442+
# (setq osbe-example-yaml-cache (make-hash-table :test 'equal))
3443+
osbe-example:~/org-special-block-extras/tests/box.yaml
34523444

3453-
#+begin_details Implementation
3454-
#+begin_src emacs-lisp
3445+
#+begin_src emacs-lisp :title Implementation :folded t
34553446
(org-defblock box (title "" background-color nil shadow nil frame-color nil title-background-color nil)
34563447
"Enclose text in a box, possibly with a title.
34573448

@@ -3524,22 +3515,7 @@ In the future, I will likely expose more arguments."
35243515
title contents)))))
35253516
#+end_src
35263517

3527-
Let's have some sanity tests...
3528-
#+begin_src emacs-lisp :tangle tests.el
3529-
(deftest "We have an HTML box enclosing the user's title (in <h3) and text"
3530-
[box]
3531-
(⇝ (⟰ "#+begin_box Pay Attention!
3532-
This is the key insight...
3533-
,#+end_box")
3534-
"<div style=\"padding: 1em;background-color: #CCFFCC;border-radius: 15px;"
3535-
(* anything)
3536-
"<h3>Pay Attention!</h3>"
3537-
(* anything)
3538-
"This is the key insight"
3539-
(* anything)))
3540-
#+end_src
3541-
#+end_details
3542-
3518+
** Three demos of [[doc:org-block/box][box]]
35433519
#+latex_header: \newunicodechar{ᵒ}{\ensuremath{{}^o}}
35443520
#+html: <br>
35453521
#+begin_box Example: A super boring observation presented obscurely :background-color blue
@@ -3573,12 +3549,12 @@ Or, with the header option ~:shadow (:left "inset cyan" :right "inset pink"
35733549

35743550
For further header options, see the documentation of [[doc:org-block/box][box]].
35753551

3576-
3552+
** Subtle Colours
35773553
#+html: <br>
3578-
In the first example above, /how did we get that nice light blue? What is its
3579-
HTML code?/ That's not something I care to remember, so let's make a handy dandy
3580-
utility … Now when users request a colour to ~box~ their text, it will be a
3581-
‘subtle colour’ ;-)
3554+
In the first example above, /how did we get that nice light blue? What
3555+
is its HTML code?/ That's not something I care to remember, so let's
3556+
make a handy dandy utility … Now when users request a colour to ~box~
3557+
their text, it will be a ‘subtle colour’ ;-)
35823558

35833559
#+begin_details Implementation for Subtle Colours
35843560
#+begin_src emacs-lisp -r -n
@@ -3605,12 +3581,10 @@ Names are very rough approximates.
36053581
))
36063582
#+end_src
36073583

3608-
#+latex: \iffalse
3584+
To use these colour names, you will need the following incantations in
3585+
your Org file.
36093586

3610-
To use these colour names, you will need the following incantations in your
3611-
Org file.
3612-
3613-
#+begin_org-demo
3587+
#+begin_src org :tangle no
36143588
#+latex_header: \usepackage{xcolor}
36153589

36163590
#+latex_header: \definecolor{teal} {HTML}{99FFCC}
@@ -3627,19 +3601,12 @@ Org file.
36273601
#+latex_header: \definecolor{custard}{HTML}{FFFFCC}
36283602

36293603
#+latex_header: \definecolor{cyan}{HTML}{00FFFF}
3630-
#+end_org-demo
3631-
3632-
#+latex_header: \definecolor{"cyan"}{HTML}{00FFFF}
3604+
#+end_src
36333605

36343606
In the future, it'd be nice to account for colours for LaTeX as well. ( E.g.,
36353607
src_latex[:exports code]{\color{blue}} is a nightmare. )
3636-
3637-
#+latex: \fi
3638-
36393608
#+end_details
36403609

3641-
It may be useful to /fuse/ the ~box~ and ~details~ concepts into one. Something for
3642-
future me ---or another contributor--- to think about ;-)
36433610
* DONE COMMENT Nice Keystroke Renditions: kbd:C-h_h
36443611
:PROPERTIES:
36453612
:CUSTOM_ID: kbd:nice-keystroke-renditions

tests/box.yaml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
input: |-
2-
#+begin_box Pay Attention!
3-
This is the key insight...
4-
(We have an HTML box enclosing the user's title and text)
5-
#+end_box
2+
It can be useful to draw attention to some important text by
3+
enclosing it in a [[doc:org-block/box][box]].
64
5+
#+begin_box Uses of callout boxes
6+
Such boxes often callout tips, warnings, cautionary info or
7+
emphasises core information.
8+
#+end_box
9+
Unmaintained: "For the LaTeX backend, the following call is required."
710
expectations:
811
html: |-
12+
<p>
13+
It can be useful to draw attention to some important text by enclosing it in a
14+
<abbr
15+
class="tooltip"
16+
title="Enclose text in a box, possibly with a title.<br><br>By default, the box’s COLOR is green for HTML and red for LaTeX,<br>and it has no TITLE.<br><br>SHADOW is an alternate style of boxing: It shows the contents in a centred<br>box with a shadow colour being the given non-nil value of SHADOW.<br>If SHADOW is a hexidecimal colour, it should be a string enclosed in double quotes.<br>More accurately, the following are all valid uses:<br><br>&emsp;&emsp;#+begin_box title :shadow t<br>&emsp;&emsp;#+begin_box title :shadow inset<br><br>&emsp;&emsp;#+begin_box title :shadow ''pink''<br>&emsp;&emsp;#+begin_box title :shadow pink<br><br>&emsp;&emsp;#+begin_box title :shadow (cyan pink orange yellow)<br>&emsp;&emsp;#+begin_box title :shadow (cyan ''inset pink'' orange)<br>&emsp;&emsp;#+begin_box title :shadow (:left cyan :right pink :deep-right orange :deep-left yellow)<br><br>Notice that prefixing colours with ‘inset’ causes the colour to be within the box,<br>rather than spread, with blur, around the box. The use of ‘inset’ swaps left and right.<br><br>The HTML export uses a padded div, whereas the LaTeX export<br>requires the tcolorbox package.<br><br>In the future, I will likely expose more arguments.<br><br>(fn BACKEND RAW-CONTENTS &rest _)"
17+
>box</abbr
18+
>.
19+
</p>
20+
921
<div
1022
style="
1123
padding: 1em;
@@ -14,15 +26,13 @@ expectations:
1426
font-size: 0.9em;
1527
"
1628
>
17-
<h3>Pay Attention!</h3>
29+
<h3>Uses of callout boxes</h3>
1830
<p>
19-
This is the key insight&#x2026; (We have an HTML box enclosing the user's
20-
title and text)
31+
Such boxes often callout tips, warnings, cautionary info or emphasises core
32+
information.
2133
</p>
2234
</div>
2335
latex: |-
24-
\begin{tcolorbox}[title={Pay Attention!},colback=red!5!white,colframe=red!75!black,colbacktitle=yellow!50!red,coltitle=red!25!black, fonttitle=\bfseries,subtitle style={boxrule=0.4pt, colback=yellow!50!red!25!white}]
25-
This is the key insight\ldots{}
26-
(We have an HTML box enclosing the user's title and text)
27-
28-
\end{tcolorbox}
36+
🚫 The LaTex backend is intentionally unmaintained.
37+
🫠 Whoops, there seems to be an error:
38+
(void-variable label)

0 commit comments

Comments
 (0)