Add olivetti and reorganize HTML export themes.

This commit is contained in:
2020-09-02 16:40:06 +02:00
parent 9a453def05
commit bcbe9840ae
4 changed files with 40 additions and 927 deletions

View File

@@ -399,57 +399,6 @@ We also want them in exported HTML files
(0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "")))))) (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) ""))))))
#+END_SRC #+END_SRC
** CSS Themes for Exports
When exporting from org-mode (usually to HTML) we want to specify additional styles.
#+BEGIN_SRC emacs-lisp
(defvar org-theme-css-dir "~/.emacs.d/org-css/")
#+END_SRC
Pack some ~.css~ files into this directory. They will be available for choosing when exporting.
The folowing code will define a function to inline css into a self-contained html file.
To use it type ~M-x toggle-org-custom-inline-style~ into an org-mode buffer.
When exporting to HTML emacs will ask which css theme to use.
#+BEGIN_SRC emacs-lisp
(defun org-html-inline-style ()
(interactive)
(let ((hook 'org-export-before-parsing-hook)
(fun 'set-org-html-style))
(if (memq fun (eval hook))
(progn
(remove-hook hook fun 'buffer-local)
(message "Removed %s from %s" (symbol-name fun) (symbol-name hook)))
(add-hook hook fun nil 'buffer-local)
(message "Added %s to %s" (symbol-name fun) (symbol-name hook)))))
(defun org-theme ()
(interactive)
(let* ((cssdir org-theme-css-dir)
(css-choices (directory-files cssdir nil ".css$"))
(css (completing-read "theme: " css-choices nil t)))
(concat cssdir css)))
(defun set-org-html-style (&optional backend)
(interactive)
(when (or (null backend) (eq backend 'html))
(let ((f (or (and (boundp 'org-theme-css) org-theme-css) (org-theme))))
(if (file-exists-p f)
(progn
(set (make-local-variable 'org-theme-css) f)
(set (make-local-variable 'org-html-head)
(with-temp-buffer
(insert "<style type=\"text/css\">\n<!--/*--><![CDATA[/*><!--*/\n")
(insert-file-contents f)
(goto-char (point-max))
(insert "\n/*]]>*/-->\n</style>\n")
(buffer-string)))
(set (make-local-variable 'org-html-head-include-default-style)
nil)
(message "Set custom style from %s" f))
(message "Custom header file %s doesnt exist")))))
#+END_SRC
** Prettier Timestamps in Exports ** Prettier Timestamps in Exports
The default timestamps look pretty unintuitive, with all the angle brackets and all. Let's make them look better. The default timestamps look pretty unintuitive, with all the angle brackets and all. Let's make them look better.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@@ -512,16 +461,30 @@ Here we define templates we want to use to quickly capture stuff and automatical
)) ))
#+END_SRC #+END_SRC
** Exports using Hugo ** CSS inlining
Using ~ox-hugo~ a directory of org files can autmatically be extported to markdown files. Auto inline a CSS theme for org HTML exports.
This will make sure a self contained single HTML file is created.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package ox-hugo (defun my-org-inline-css-hook (exporter)
:ensure t ;Auto-install the package from Melpa (optional) "Insert custom inline css"
:after ox) (when (eq exporter 'html)
(let* ((dir (ignore-errors (file-name-directory (buffer-file-name))))
(path (concat dir "style.css"))
(homestyle (or (null dir) (null (file-exists-p path))))
(final (if homestyle "~/.emacs.d/org-theme.css" path))) ;; <- set your own style file path
(setq org-html-head-include-default-style nil)
(setq org-html-head (concat
"<style type=\"text/css\">\n"
"<!--/*--><![CDATA[/*><!--*/\n"
(with-temp-buffer
(insert-file-contents final)
(buffer-string))
"/*]]>*/-->\n"
"</style>\n")))))
(add-hook 'org-export-before-processing-hook 'my-org-inline-css-hook)
#+END_SRC #+END_SRC
[[https://ox-hugo.scripter.co/][Documentation]]
* Treemacs * Treemacs
Treemacs makes navigating folders and files much easier. This is the default config from [[https://github.com/Alexander-Miller/treemacs][the offical repository]] as a base, with slight modifications to suite my config. Treemacs makes navigating folders and files much easier. This is the default config from [[https://github.com/Alexander-Miller/treemacs][the offical repository]] as a base, with slight modifications to suite my config.
@@ -583,9 +546,8 @@ Treemacs makes navigating folders and files much easier. This is the default con
(treemacs-git-mode 'simple)))) (treemacs-git-mode 'simple))))
:bind :bind
(:map global-map (:map global-map
("M-0" . treemacs-select-window) ("M-0" . treemacs)
("C-x t 1" . treemacs-delete-other-windows) ("C-x t 1" . treemacs-delete-other-windows)
("C-x t t" . treemacs)
("C-x t B" . treemacs-bookmark) ("C-x t B" . treemacs-bookmark)
("C-x t C-t" . treemacs-find-file) ("C-x t C-t" . treemacs-find-file)
("C-x t M-t" . treemacs-find-tag))) ("C-x t M-t" . treemacs-find-tag)))
@@ -690,6 +652,22 @@ The packages only works on linux and reuqires that emacs is compiled with module
(setq vterm-kill-buffer-on-exit t) (setq vterm-kill-buffer-on-exit t)
(setq vterm-copy-exclude-prompt t))) (setq vterm-copy-exclude-prompt t)))
#+End_SRC #+End_SRC
** Olivetti
A simple Emacs minor mode for a nice writing environment.
[[https://github.com/rnkn/olivetti][Gihub Link]]
#+BEGIN_SRC emacs-lisp
(use-package olivetti
:config
(setq-default
olivetti-hide-mode-line t
olivetti-body-width 90))
#+END_SRC
Auto enable it in text modes
#+BEGIN_SRC emacs-lisp
(add-hook 'text-mode-hook 'olivetti-mode)
#+END_SRC
* Set Variables * Set Variables
** General Emacs Options ** General Emacs Options
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp

File diff suppressed because one or more lines are too long

View File

@@ -1,864 +0,0 @@
/* more:
orgmode.org/worg/style/worg.css
orgmode.org/worg/style/worg-classic.css
orgmode.org/worg/style/worg-zenburn.css
...and Google....
*/
body {
margin: 1em;
border-right: 5px solid #bbb;
border-bottom: 5px solid #bbb;
padding: 0;
background: #ddd none repeat scroll 0 0;
border: 1px solid #000;
margin: 0;
padding: 2em;
color: #000;
/* font-family: "Bitstream Vera Sans", Verdana, sans-serif; */
font-family: "PT Sans", Verdana, sans-serif;
font-size: 110%;
}
/* for verbatim and code (== and ~~) text */
code {
/* border: 1px solid Silver; */
background-color: #d6d8ec;
}
div#content {
border: 1px solid #bbb;
background: #fff;
margin: 0;
padding: 2em;
}
/* links */
a {text-decoration: none; font-weight: 400;}
a:visited {text-decoration: none; font-weight: 400;}
a:hover {text-decoration: underline;}
#table-of-contents {
font-size: 11pt;
position: fixed;
right: 0em;
top: 0em;
background: white;
line-height: 14pt;
text-align: right;
box-shadow: 0 0 1em #777777;
-webkit-box-shadow: 0 0 1em #777777;
-moz-box-shadow: 0 0 1em #777777;
-webkit-border-bottom-left-radius: 5px;
-moz-border-radius-bottomleft: 5px;
/* ensure doesn't flow off the screen when expanded */
max-height: 100%;
overflow: auto; }
#table-of-contents h2 {
font-size: 13pt;
max-width: 9em;
border: 0;
font-weight: normal;
padding-left: 0.5em;
padding-right: 0.5em;
padding-top: 0.05em;
padding-bottom: 0.05em; }
#table-of-contents #text-table-of-contents {
display: none;
text-align: left; }
#table-of-contents:hover #text-table-of-contents {
display: block;
padding: 0.5em;
margin-top: -1.5em; }
div#content div#org-div-home-and-up {
background: #369;
color: #fff;
}
div#org-div-home-and-up a:link,
div#org-div-home-and-up a:visited {
color: #fff;
background: #369;
}
div#org-div-home-and-up a:hover {
color: #900;
}
div.title {
margin: -1em -1em 0;
font-size: 200%;
font-weight: bold;
background: #369;
color: #fff;
padding: .75em 1em;
/* font-family: "BitStream Vera Sans", Verdana;*/
font-family: "PT Sans", Verdana;
letter-spacing: .1em;
}
/* heads */
h1 {
background: #369 none repeat scroll 0 0;
color: #fff;
font-family: "BitStream Vera Sans", Verdana;
font-size: 200%;
font-weight: bold;
letter-spacing: 0.1em;
margin: -1em -1em .2em;
padding: 0.75em 1em;
}
h2 {
font-size: 180%;
border-bottom: 1px solid #ccc;
padding: .2em;
}
.outline-text-2 {
margin-left: 0.1em
}
h3 {
font-size: 120%;
border-bottom: 1px solid #eee;
margin-left: 0.6em;
}
.outline-text-3 {
margin-left: 0.9em;
}
h4 {
font-size: 110%;
border-bottom: 1px solid #eee;
margin-left: 1.2em;
}
.outline-text-4 {
margin-left: 1.45em;
}
tt {
color: #00f;
}
.verbatim {
margin: .5em 0;
}
pre {
border: 1px solid #ccc;
background: #eee;
padding: .5em;
overflow: auto;
}
.verbatim pre {
margin: 0;
}
.verbatim-caption {
border: 1px solid #ccc;
border-bottom: 0;
background: #fff;
display: block;
font-size: 100%;
padding: .2em;
}
div#postamble {
text-align: left;
color: #888;
font-size: 80%;
padding: 0;
margin: 0;
}
div#postamble p {
padding: 0;
margin: 0;
}
div#postamble a {
color: #888;
}
div#postamble a:hover {
color: #900;
}
kbd {
padding:0.1em 0.6em;
border:1px solid #ccc;
font-size:13px;
font-weight:bold;
font-family:monospace;
background-color:#d6d8ec;
color:#333;
-moz-box-shadow:0 1px 0px rgba(0, 0, 0, 0.2),0 0 0 2px #ffffff inset;
-webkit-box-shadow:0 1px 0px rgba(0, 0, 0, 0.2),0 0 0 2px #ffffff inset;
box-shadow:0 1px 0px rgba(0, 0, 0, 0.2),0 0 0 2px #ffffff inset;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
display:inline-block;
margin:0 0.1em;
text-shadow:0 1px 0 #fff;
line-height:1.4;
white-space:nowrap;
}
table {
font-size: 100%;
border-collapse: collapse;
margin-left: 1.5em;
border: 0px;
}
th, td {
border: 1px solid #777;
padding: .3em;
margin: 2px;
}
th {
background: #eee;
}
span.underline {
text-decoration: underline;
}
.fixme {
background: #ff0;
font-weight: bold;
}
.ra {
text-align: right;
}
.sidebar {
float: right;
width: 25em;
background-color: #a02f6c;
color: #fff;
margin: 2em -2em 2em 2em;
padding: 1em;
}
.sidebar a {
border: none;
}
.sidebar a:link {
color: #3ff;
}
.sidebar a:visited {
color: #3cc;
}
.sidebar a:hover {
color: #ff6;
}
.sidebar a:active {
color: #900;
}
/* Todo List Styles */
.title { text-align: center; }
.todo { color: red; }
.done { color: green; }
.timestamp { color: gray }
.timestamp-kwd { color: #f59ea0; }
.tag { background-color:#add8e6; font-weight:normal }
.target { background-color: #551a8b; }
table { border-collapse: collapse; }
td, th {
vertical-align: top;
}
/* for begin_example */
pre {
border: 1pt solid #AEBDCC;
background-color: #eee;
padding: 5pt;
font-family: courier, monospace;
font-size: 90%;
overflow: auto
}
/* for begin_quote*/
blockquote {
border-left: 3px solid #ccc;
/* font-family: "BitStream Vera Sans", Verdana; */
/* font-size: 90%; */
font-style: italic;
/* color: #999; */
margin-top: 10px;
margin-bottom: 10px;
margin-left: 50px;
padding-left: 15px;
}
/*
* The following setting seems useless
*/
/* Source code formatting */
.org-info-search-highlight
{
background-color:#adefef; /* same color as emacs default */
color:#000000;
font-weight:bold;
}
.org-bbdb-company {
/* bbdb-company */
font-style: italic;
}
.org-bbdb-field-name {
}
.org-bbdb-field-value {
}
.org-bbdb-name {
/* bbdb-name */
text-decoration: underline;
}
.org-bold {
/* bold */
font-weight: bold;
}
.org-bold-italic {
/* bold-italic */
font-weight: bold;
font-style: italic;
}
.org-border {
/* border */
background-color: #000000;
}
.org-buffer-menu-buffer {
/* buffer-menu-buffer */
font-weight: bold;
}
.org-builtin {
/* font-lock-builtin-face */
color: #da70d6;
}
.org-button {
/* button */
text-decoration: underline;
}
.org-c-nonbreakable-space {
/* c-nonbreakable-space-face */
background-color: #ff0000;
font-weight: bold;
}
.org-calendar-today {
/* calendar-today */
text-decoration: underline;
}
.org-comment {
/* font-lock-comment-face */
color: #b22222;
}
.org-comment-delimiter {
/* font-lock-comment-delimiter-face */
color: #b22222;
}
.org-constant {
/* font-lock-constant-face */
color: #5f9ea0;
}
.org-cursor {
/* cursor */
background-color: #000000;
}
.org-default {
/* default */
color: #000000;
background-color: #ffffff;
}
.org-diary {
/* diary */
color: #ff0000;
}
.org-doc {
/* font-lock-doc-face */
color: #bc8f8f;
}
.org-escape-glyph {
/* escape-glyph */
color: #a52a2a;
}
.org-file-name-shadow {
/* file-name-shadow */
color: #7f7f7f;
}
.org-fixed-pitch {
}
.org-fringe {
/* fringe */
background-color: #f2f2f2;
}
.org-function-name {
/* font-lock-function-name-face */
color: #0000ff;
}
.org-header-line {
/* header-line */
color: #333333;
background-color: #e5e5e5;
}
.org-help-argument-name {
/* help-argument-name */
font-style: italic;
}
.org-highlight {
/* highlight */
background-color: #b4eeb4;
}
.org-holiday {
/* holiday */
background-color: #ffc0cb;
}
.org-info-header-node {
/* info-header-node */
color: #a52a2a;
font-weight: bold;
font-style: italic;
}
.org-info-header-xref {
/* info-header-xref */
color: #0000ff;
text-decoration: underline;
}
.org-info-menu-header {
/* info-menu-header */
font-weight: bold;
}
.org-info-menu-star {
/* info-menu-star */
color: #ff0000;
}
.org-info-node {
/* info-node */
color: #a52a2a;
font-weight: bold;
font-style: italic;
}
.org-info-title-1 {
/* info-title-1 */
font-size: 172%;
font-weight: bold;
}
.org-info-title-2 {
/* info-title-2 */
font-size: 144%;
font-weight: bold;
}
.org-info-title-3 {
/* info-title-3 */
font-size: 120%;
font-weight: bold;
}
.org-info-title-4 {
/* info-title-4 */
font-weight: bold;
}
.org-info-xref {
/* info-xref */
color: #0000ff;
text-decoration: underline;
}
.org-isearch {
/* isearch */
color: #b0e2ff;
background-color: #cd00cd;
}
.org-italic {
/* italic */
font-style: italic;
}
.org-keyword {
/* font-lock-keyword-face */
color: #a020f0;
}
.org-lazy-highlight {
/* lazy-highlight */
background-color: #afeeee;
}
.org-link {
/* link */
color: #0000ff;
text-decoration: underline;
}
.org-link-visited {
/* link-visited */
color: #8b008b;
text-decoration: underline;
}
.org-match {
/* match */
background-color: #ffff00;
}
.org-menu {
}
.org-message-cited-text {
/* message-cited-text */
color: #ff0000;
}
.org-message-header-cc {
/* message-header-cc */
color: #191970;
}
.org-message-header-name {
/* message-header-name */
color: #6495ed;
}
.org-message-header-newsgroups {
/* message-header-newsgroups */
color: #00008b;
font-weight: bold;
font-style: italic;
}
.org-message-header-other {
/* message-header-other */
color: #4682b4;
}
.org-message-header-subject {
/* message-header-subject */
color: #000080;
font-weight: bold;
}
.org-message-header-to {
/* message-header-to */
color: #191970;
font-weight: bold;
}
.org-message-header-xheader {
/* message-header-xheader */
color: #0000ff;
}
.org-message-mml {
/* message-mml */
color: #228b22;
}
.org-message-separator {
/* message-separator */
color: #a52a2a;
}
.org-minibuffer-prompt {
/* minibuffer-prompt */
color: #0000cd;
}
.org-mm-uu-extract {
/* mm-uu-extract */
color: #006400;
background-color: #ffffe0;
}
.org-mode-line {
/* mode-line */
color: #000000;
background-color: #bfbfbf;
}
.org-mode-line-buffer-id {
/* mode-line-buffer-id */
font-weight: bold;
}
.org-mode-line-highlight {
}
.org-mode-line-inactive {
/* mode-line-inactive */
color: #333333;
background-color: #e5e5e5;
}
.org-mouse {
/* mouse */
background-color: #000000;
}
.org-negation-char {
}
.org-next-error {
/* next-error */
background-color: #eedc82;
}
.org-nobreak-space {
/* nobreak-space */
color: #a52a2a;
text-decoration: underline;
}
.org-org-agenda-date {
/* org-agenda-date */
color: #0000ff;
}
.org-org-agenda-date-weekend {
/* org-agenda-date-weekend */
color: #0000ff;
font-weight: bold;
}
.org-org-agenda-restriction-lock {
/* org-agenda-restriction-lock */
background-color: #ffff00;
}
.org-org-agenda-structure {
/* org-agenda-structure */
color: #0000ff;
}
.org-org-archived {
/* org-archived */
color: #7f7f7f;
}
.org-org-code {
/* org-code */
color: #7f7f7f;
}
.org-org-column {
/* org-column */
background-color: #e5e5e5;
}
.org-org-column-title {
/* org-column-title */
background-color: #e5e5e5;
font-weight: bold;
text-decoration: underline;
}
.org-org-date {
/* org-date */
color: #a020f0;
text-decoration: underline;
}
.org-org-done {
/* org-done */
color: #228b22;
font-weight: bold;
}
.org-org-drawer {
/* org-drawer */
color: #0000ff;
}
.org-org-ellipsis {
/* org-ellipsis */
color: #b8860b;
text-decoration: underline;
}
.org-org-formula {
/* org-formula */
color: #b22222;
}
.org-org-headline-done {
/* org-headline-done */
color: #bc8f8f;
}
.org-org-hide {
/* org-hide */
color: #e5e5e5;
}
.org-org-latex-and-export-specials {
/* org-latex-and-export-specials */
color: #8b4513;
}
.org-org-level-1 {
/* org-level-1 */
color: #0000ff;
}
.org-org-level-2 {
/* org-level-2 */
color: #b8860b;
}
.org-org-level-3 {
/* org-level-3 */
color: #a020f0;
}
.org-org-level-4 {
/* org-level-4 */
color: #b22222;
}
.org-org-level-5 {
/* org-level-5 */
color: #228b22;
}
.org-org-level-6 {
/* org-level-6 */
color: #5f9ea0;
}
.org-org-level-7 {
/* org-level-7 */
color: #da70d6;
}
.org-org-level-8 {
/* org-level-8 */
color: #bc8f8f;
}
.org-org-link {
/* org-link */
color: #a020f0;
text-decoration: underline;
}
.org-org-property-value {
}
.org-org-scheduled-previously {
/* org-scheduled-previously */
color: #b22222;
}
.org-org-scheduled-today {
/* org-scheduled-today */
color: #006400;
}
.org-org-sexp-date {
/* org-sexp-date */
color: #a020f0;
}
.org-org-special-keyword {
/* org-special-keyword */
color: #bc8f8f;
}
.org-org-table {
/* org-table */
color: #0000ff;
}
.org-org-tag {
/* org-tag */
font-weight: bold;
}
.org-org-target {
/* org-target */
text-decoration: underline;
}
.org-org-time-grid {
/* org-time-grid */
color: #b8860b;
}
.org-org-todo {
/* org-todo */
color: #ff0000;
}
.org-org-upcoming-deadline {
/* org-upcoming-deadline */
color: #b22222;
}
.org-org-verbatim {
/* org-verbatim */
color: #7f7f7f;
text-decoration: underline;
}
.org-org-warning {
/* org-warning */
color: #ff0000;
font-weight: bold;
}
.org-outline-1 {
/* outline-1 */
color: #0000ff;
}
.org-outline-2 {
/* outline-2 */
color: #b8860b;
}
.org-outline-3 {
/* outline-3 */
color: #a020f0;
}
.org-outline-4 {
/* outline-4 */
color: #b22222;
}
.org-outline-5 {
/* outline-5 */
color: #228b22;
}
.org-outline-6 {
/* outline-6 */
color: #5f9ea0;
}
.org-outline-7 {
/* outline-7 */
color: #da70d6;
}
.org-outline-8 {
/* outline-8 */
color: #bc8f8f;
}
.org-preprocessor {
/* font-lock-preprocessor-face */
color: #da70d6;
}
.org-query-replace {
/* query-replace */
color: #b0e2ff;
background-color: #cd00cd;
}
.org-regexp-grouping-backslash {
/* font-lock-regexp-grouping-backslash */
font-weight: bold;
}
.org-regexp-grouping-construct {
/* font-lock-regexp-grouping-construct */
font-weight: bold;
}
.org-region {
/* region */
background-color: #eedc82;
}
.org-rmail-highlight {
}
.org-scroll-bar {
/* scroll-bar */
background-color: #bfbfbf;
}
.org-secondary-selection {
/* secondary-selection */
background-color: #ffff00;
}
.org-shadow {
/* shadow */
color: #7f7f7f;
}
.org-show-paren-match {
/* show-paren-match */
background-color: #40e0d0;
}
.org-show-paren-mismatch {
/* show-paren-mismatch */
color: #ffffff;
background-color: #a020f0;
}
.org-string {
/* font-lock-string-face */
color: #bc8f8f;
}
.org-texinfo-heading {
/* texinfo-heading */
color: #0000ff;
}
.org-tool-bar {
/* tool-bar */
color: #000000;
background-color: #bfbfbf;
}
.org-tooltip {
/* tooltip */
color: #000000;
background-color: #ffffe0;
}
.org-trailing-whitespace {
/* trailing-whitespace */
background-color: #ff0000;
}
.org-type {
/* font-lock-type-face */
color: #228b22;
}
.org-underline {
/* underline */
text-decoration: underline;
}
.org-variable-name {
/* font-lock-variable-name-face */
color: #b8860b;
}
.org-variable-pitch {
}
.org-vertical-border {
}
.org-warning {
/* font-lock-warning-face */
color: #ff0000;
font-weight: bold;
}

View File

@@ -243,6 +243,7 @@ table {
display: block; display: block;
overflow-x: auto; overflow-x: auto;
text-align: center; text-align: center;
border-width: 0;
} }
caption.t-above { caption.t-above {