emacs-config/misc/org-css/_code.scss

310 lines
7.7 KiB
SCSS

// Code highlighting
pre.src, pre.example {
@include left-line();
font-family: $code-font;
font-size: 14px;
line-height: 1.9;
overflow-x: visible;
box-shadow: none;
white-space: pre-wrap;
position: relative;
}
pre.example {
border-left-style: dotted;
border-left-width: 2px;
}
pre.src::before {
display: inline-block;
position: absolute;
background-color: transparent;
top: unset;
bottom: -16px;
left: 20px;
padding: 0px;
border: none;
font-size: 80%;
font-style: italic;
color: $text-light;
}
// accout for the odd result of noweb
pre.src:empty {
display: none;
}
code {
font-family: $code-font;
color: $code-foreground;
font-size: 0.9em;
padding: 0 2px;
}
kbd {
display: inline-block;
padding: 0.25em 0.35em;
font: 80% $code-font;
font-weight: inherit;
line-height: normal;
line-height: 80%;
color: $text-gray;
vertical-align: middle;
background-color: $back-light;
border: 1px solid #91959a88;
border-radius: 0.35em;
box-shadow: inset 0 -1px 0 #91959a88;
}
li {
code {
font-size: 14px;
}
p code {
font-size: 15px;
}
}
// folding
details.code {
position: relative;
summary {
position: relative;
left: -2.5px;
padding-left: 10px;
padding-bottom: 4px;
margin-left: -10px;
z-index: 1;
outline: none;
@include light-meta;
.name {
font-size: 14px;
color: $text-medium;
margin-right: 0.7em;
}
.lang {
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
font-style: italic;
}
}
summary::marker {
color: $back-medium;
}
&[open] summary {
margin-bottom: -32px;
.lang {
display: none;
}
}
&[open] summary.named {
margin-bottom: -26px;
}
&:not([open]) summary {
margin-bottom: -5px;
}
}
// de-duplicate margin
p + details.code {
margin-top: -20px; // pre margin size
}
li p + details.code {
margin-top: -5px;
}
// Palette copied from blog
// ------------------------
// foreground: #655370
// background: #ffffff
$code-builtin: #3a81c3;
$code-comment: #555555;
// $code-constant in _theme
$code-doc: $cyan;
// $code-func in _theme
$code-keyword: $blue;
// $code-regex:
$code-string: $green;
$code-type: $red;
$code-variable: $purple;
$code-warning: $orange;
.example,
.src {
color: $code-foreground;
.org-keyword {
color: $code-keyword;
}
.org-variable-name {
color: $code-variable;
}
.org-rainbow-delimiters-depth-1,
.org-rainbow-delimiters-depth-2,
.org-rainbow-delimiters-depth-3,
.org-rainbow-delimiters-depth-4,
.org-rainbow-delimiters-depth-5,
.org-rainbow-delimiters-depth-6,
.org-rainbow-delimiters-depth-7,
.org-rainbow-delimiters-depth-8,
.org-rainbow-delimiters-depth-9 {
color: $code-comment;
}
.org-string {
color: $code-string;
}
.org-comment,
.org-comment-delimiter {
color: $code-comment;
}
.org-function-name {
color: $code-func;
}
.org-constant,
.org-highlight-numbers-number {
color: $code-constant;
}
}
// id link, and copy button
.gutter {
position: absolute;
top: 0;
left: -2.5rem;
width: 2rem;
padding-right: 0.3rem;
padding-top: 5px;
height: calc(100% - 10px);
z-index: 1;
transition: opacity 200ms;
opacity: 0;
font-size: 15px;
&:hover {
opacity: 1;
}
* {
display: block;
width: 100%;
text-align: right;
padding: 0;
margin: 0;
color: $text-light;
&:hover {
color: $text-gray;
}
&:active {
font-weight: bold;
}
}
a {
text-decoration: none;
font-size: 110%;
}
button {
background: none;
border: none;
}
}
/* Languages per Org manual */
pre.src-asymptote::before { content: 'Asymptote'; }
pre.src-authinfo::before { content: 'Authinfo'; }
pre.src-awk::before { content: 'Awk'; }
pre.src-C::before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure::before { content: 'Clojure'; }
pre.src-css::before { content: 'CSS'; }
pre.src-D::before { content: 'D'; }
pre.src-ditaa::before { content: 'ditaa'; }
pre.src-dot::before { content: 'Graphviz'; }
pre.src-calc::before { content: 'Emacs Calc'; }
pre.src-emacs-lisp::before { content: 'Emacs Lisp'; }
pre.src-fortran::before { content: 'Fortran'; }
pre.src-gnuplot::before { content: 'gnuplot'; }
pre.src-haskell::before { content: 'Haskell'; }
pre.src-hledger::before { content: 'hledger'; }
pre.src-java::before { content: 'Java'; }
pre.src-js::before { content: 'Javascript'; }
pre.src-latex::before { content: 'LaTeX'; }
pre.src-ledger::before { content: 'Ledger'; }
pre.src-lisp::before { content: 'Lisp'; }
pre.src-lilypond::before { content: 'Lilypond'; }
pre.src-lua::before { content: 'Lua'; }
pre.src-matlab::before { content: 'MATLAB'; }
pre.src-mscgen::before { content: 'Mscgen'; }
pre.src-ocaml::before { content: 'Objective Caml'; }
pre.src-octave::before { content: 'Octave'; }
pre.src-org::before { content: 'Org mode'; }
pre.src-oz::before { content: 'OZ'; }
pre.src-plantuml::before { content: 'Plantuml'; }
pre.src-processing::before { content: 'Processing.js'; }
pre.src-python::before { content: 'Python'; }
pre.src-R::before { content: 'R'; }
pre.src-ruby::before { content: 'Ruby'; }
pre.src-sass::before { content: 'Sass'; }
pre.src-scheme::before { content: 'Scheme'; }
pre.src-screen::before { content: 'Gnu Screen'; }
pre.src-sed::before { content: 'Sed'; }
pre.src-sh::before { content: 'shell'; }
pre.src-sql::before { content: 'SQL'; }
pre.src-sqlite::before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth::before { content: 'Forth'; }
pre.src-io::before { content: 'IO'; }
pre.src-J::before { content: 'J'; }
pre.src-makefile::before { content: 'Makefile'; }
pre.src-maxima::before { content: 'Maxima'; }
pre.src-perl::before { content: 'Perl'; }
pre.src-picolisp::before { content: 'Pico Lisp'; }
pre.src-scala::before { content: 'Scala'; }
pre.src-shell::before { content: 'Shell Script'; }
pre.src-systemd::before { content: 'Systemd'; }
pre.src-ebnf2ps::before { content: 'ebfn2ps'; }
/* additional language identifiers per \"defun org-babel-execute\"
in ob-*.el */
pre.src-cpp::before { content: 'C++'; }
pre.src-abc::before { content: 'ABC'; }
pre.src-coq::before { content: 'Coq'; }
pre.src-groovy::before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash::before { content: 'bash'; }
pre.src-csh::before { content: 'csh'; }
pre.src-ash::before { content: 'ash'; }
pre.src-dash::before { content: 'dash'; }
pre.src-ksh::before { content: 'ksh'; }
pre.src-mksh::before { content: 'mksh'; }
pre.src-posh::before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada::before { content: 'Ada'; }
pre.src-asm::before { content: 'Assembler'; }
pre.src-caml::before { content: 'Caml'; }
pre.src-delphi::before { content: 'Delphi'; }
pre.src-html::before { content: 'HTML'; }
pre.src-idl::before { content: 'IDL'; }
pre.src-mercury::before { content: 'Mercury'; }
pre.src-metapost::before { content: 'MetaPost'; }
pre.src-modula-2::before { content: 'Modula-2'; }
pre.src-pascal::before { content: 'Pascal'; }
pre.src-ps::before { content: 'PostScript'; }
pre.src-prolog::before { content: 'Prolog'; }
pre.src-simula::before { content: 'Simula'; }
pre.src-tcl::before { content: 'tcl'; }
pre.src-tex::before { content: 'LaTeX'; }
pre.src-plain-tex::before { content: 'TeX'; }
pre.src-verilog::before { content: 'Verilog'; }
pre.src-vhdl::before { content: 'VHDL'; }
pre.src-xml::before { content: 'XML'; }
pre.src-nxml::before { content: 'XML'; }
pre.src-conf::before { content: 'Configuration File'; }