From e847b05ae3bae9cc4134a7b5f5f66f0771edfa9e Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Fri, 14 Sep 2018 10:58:48 +0200 Subject: Update syntax highlighting configuration Now both Markdown and AsciiDoc files will use pygments for their highlighting. --- .gitignore | 1 + _config.yml | 3 +- _posts/2016-10-03-install-funtoo.md | 28 ++-- ...bsd-mailserver-part-4-message-authentication.md | 13 +- ...-31-freebsd-mailserver-part-5-filtering-mail.md | 4 +- ...24-freebsd-mailserver-calendars-and-contacts.md | 4 +- css/main.less | 2 +- css/pygments.scss | 141 +++++++++++---------- 8 files changed, 100 insertions(+), 96 deletions(-) diff --git a/.gitignore b/.gitignore index 4c8859f..6e837c0 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ _site .jekyll-metadata *.bak css/pygments.base.css +asciidoc-pygments.css diff --git a/_config.yml b/_config.yml index 1aad209..499af4f 100644 --- a/_config.yml +++ b/_config.yml @@ -27,14 +27,13 @@ keep_files: asciidoctor: attributes: imagesdir: /img - pygments-style: emacs - pygments-stylesheet: css/pygments.base.css source-highlighter: pygments sass: style: compressed # Build settings markdown: redcarpet +highlighter: pygments include: ["_pages"] diff --git a/_posts/2016-10-03-install-funtoo.md b/_posts/2016-10-03-install-funtoo.md index 6526093..66dd146 100644 --- a/_posts/2016-10-03-install-funtoo.md +++ b/_posts/2016-10-03-install-funtoo.md @@ -84,7 +84,7 @@ The size of your storage device should be at least 35GB to be safe and have some space for personal data. The partitioning layout this guide is aiming for is the following: -{% highlight plain %} +``` DEVICE FILESYSTEM SIZE MOUNTPOINT sda sda1 fat32 2GB /boot @@ -96,7 +96,7 @@ sda funtoo0-swap swap funtoo0-packages xfs 10GB /var/packages funtoo0-distfiles xfs 10GB /var/distfiles -{% endhighlight %} +``` If you already an advanced user, you are of course free to diverge from the guide here. @@ -316,7 +316,7 @@ Once you know the UUID, open up `/etc/fstab` with whatever editor you feel comfortable with and make it look like the following block of text. Do not forget to update the UUIDs! -{% highlight plain %} +``` # boot device /dev/sda1 /boot vfat noauto,noatime 1 2 @@ -335,7 +335,7 @@ tmpfs /tmp tmpfs defaults 0 0 # binds /tmp /var/tmp none rbind 0 0 -{% endhighlight %} +``` ##### /etc/localtime The localtime comes next. This is to make sure your time is set correctly. An @@ -559,29 +559,29 @@ you. As the guide uses LVM and LUKS, you will need to have support for these things in your kernel. You will need to enable the following options at the very least: -{% highlight plain %} +``` General setup ---> [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support -{% endhighlight %} +``` -{% highlight plain %} +``` Device Drivers ---> Generic Driver Options ---> [*] Maintain a devtmpfs filesystem to mount at /dev -{% endhighlight %} +``` -{% highlight plain %} +``` Device Drivers ---> [*] Multiple devices driver support ---> <*>Device Mapper Support <*> Crypt target support -{% endhighlight %} +``` -{% highlight plain %} +``` Cryptographic API ---> <*> XTS support -*-AES cipher algorithms -{% endhighlight %} +``` #### Setup ZFS The kernel is now installed at `/boot`, and all the required parts to build @@ -619,7 +619,7 @@ and `lvm`. Open up `/etc/boot.conf` in your favourite editor and let the file display something like this: -{% highlight plain %} +``` boot { generate grub default "Funtoo GNU+Linux" @@ -631,7 +631,7 @@ boot { initrd initramfs[-v] params += crypt_root=/dev/sda2 real_root=/dev/mapper/funtoo0-root rootfstype=xfs dolvm } -{% endhighlight %} +``` Now that `boot-update` is configured, install `grub` as an UEFI bootloader and generate the configs for it using `boot-update`. You should make sure the diff --git a/_posts/2016-10-31-freebsd-mailserver-part-4-message-authentication.md b/_posts/2016-10-31-freebsd-mailserver-part-4-message-authentication.md index 38e4a15..3b7a78a 100644 --- a/_posts/2016-10-31-freebsd-mailserver-part-4-message-authentication.md +++ b/_posts/2016-10-31-freebsd-mailserver-part-4-message-authentication.md @@ -26,7 +26,7 @@ pkg install opendkim ### Configuration Write the following configuration into `/usr/local/etc/mail/opendkim.conf`. -{% highlight conf %} +{% highlight apache %} # logging Syslog yes @@ -109,7 +109,8 @@ straightforward and can be done using a simple `echo` as well. {% highlight sh %} echo '*@domain.tld domain.tld' >> /usr/local/etc/opendkim/signing.table -echo "domain.tld domain.tld:$(date +%Y%m%d):/usr/local/etc/opendkim/keys/domain.tld/$(date +%Y%m%d).private" >> /usr/local/etc/opendkim/key.table +echo "domain.tld domain.tld:$(date +%Y%m%d):/usr/local/etc/opendkim/keys/domain.tld/$(date +%Y%m%d).private" \ + >> /usr/local/etc/opendkim/key.table {% endhighlight %} ### Adding the DNS records @@ -126,9 +127,9 @@ domain. A simple example for an SPF record is the following. It allows mail to be sent in the domain's name from any IP listed in the MX records. -{% highlight plain %} +``` v=spf1 mx -all -{% endhighlight %} +``` ## DMARC DMARC is, like SPF, a DNS record. It tells how to deal with messages coming @@ -142,9 +143,9 @@ authentication. This means the emails will go into the receiving user's spam box. In addition, abuse reports will be sent to the address defined in the `rua`. -{% highlight plain %} +``` v=DMARC1; p=quarantine; rua=mailto:abuse@domain.tld -{% endhighlight %} +``` ## Conclusion These few simple measures will make receiving servers trust the authenticity of diff --git a/_posts/2016-10-31-freebsd-mailserver-part-5-filtering-mail.md b/_posts/2016-10-31-freebsd-mailserver-part-5-filtering-mail.md index 6c58284..09cc280 100644 --- a/_posts/2016-10-31-freebsd-mailserver-part-5-filtering-mail.md +++ b/_posts/2016-10-31-freebsd-mailserver-part-5-filtering-mail.md @@ -75,7 +75,7 @@ named `sieve`. This file is generally saved at `/srv/mail/domain.tld/user/sieve`. A default file to filter spam out is the following example. -{% highlight sieve %} +``` require [ "fileinto", "mailbox" @@ -85,7 +85,7 @@ if header :contains "X-Spam-Flag" "YES" { fileinto :create "Junk"; stop; } -{% endhighlight %} +``` This looks for the `X-Spam-Flag` header, which is added by SpamAssassin. If it is set to `YES`, this indicates SpamAssassin thinks the message is spam. As diff --git a/_posts/2016-11-24-freebsd-mailserver-calendars-and-contacts.md b/_posts/2016-11-24-freebsd-mailserver-calendars-and-contacts.md index 55ae23d..294161c 100644 --- a/_posts/2016-11-24-freebsd-mailserver-calendars-and-contacts.md +++ b/_posts/2016-11-24-freebsd-mailserver-calendars-and-contacts.md @@ -77,7 +77,7 @@ option is needed again. Bind it to `localhost`, so it can only be used internally. In `/usr/local/etc/dovecont/conf.d/10-master.conf`, enable the `imap` port again: -{% highlight conf %} +``` ... service imap-login { inet_listener imap { @@ -87,7 +87,7 @@ service imap-login { ... } ... -{% endhighlight %} +``` ## Configure nginx To make using the service easier, you can setup [nginx][nginx] to act as a diff --git a/css/main.less b/css/main.less index 21f7a8e..af1605f 100644 --- a/css/main.less +++ b/css/main.less @@ -32,7 +32,7 @@ table { width: 100%; } -pre.pygments { +figure.highlight pre, pre.pygments { border: 2px solid @blockBorderColor; padding: 8px; } diff --git a/css/pygments.scss b/css/pygments.scss index 98fbf5a..8c1f06d 100644 --- a/css/pygments.scss +++ b/css/pygments.scss @@ -1,71 +1,74 @@ --- --- -.listingblock .pygments .hll { background-color: #ffffcc } -.listingblock .pygments, .listingblock .pygments code { background: #f8f8f8; } -.listingblock .pygments .tok-c { color: #008800; font-style: italic } /* Comment */ -.listingblock .pygments .tok-err { border: 1px solid #FF0000 } /* Error */ -.listingblock .pygments .tok-k { color: #AA22FF; font-weight: bold } /* Keyword */ -.listingblock .pygments .tok-o { color: #666666 } /* Operator */ -.listingblock .pygments .tok-ch { color: #008800; font-style: italic } /* Comment.Hashbang */ -.listingblock .pygments .tok-cm { color: #008800; font-style: italic } /* Comment.Multiline */ -.listingblock .pygments .tok-cp { color: #008800 } /* Comment.Preproc */ -.listingblock .pygments .tok-cpf { color: #008800; font-style: italic } /* Comment.PreprocFile */ -.listingblock .pygments .tok-c1 { color: #008800; font-style: italic } /* Comment.Single */ -.listingblock .pygments .tok-cs { color: #008800; font-weight: bold } /* Comment.Special */ -.listingblock .pygments .tok-gd { color: #A00000 } /* Generic.Deleted */ -.listingblock .pygments .tok-ge { font-style: italic } /* Generic.Emph */ -.listingblock .pygments .tok-gr { color: #FF0000 } /* Generic.Error */ -.listingblock .pygments .tok-gh { color: #000080; font-weight: bold } /* Generic.Heading */ -.listingblock .pygments .tok-gi { color: #00A000 } /* Generic.Inserted */ -.listingblock .pygments .tok-go { color: #888888 } /* Generic.Output */ -.listingblock .pygments .tok-gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -.listingblock .pygments .tok-gs { font-weight: bold } /* Generic.Strong */ -.listingblock .pygments .tok-gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -.listingblock .pygments .tok-gt { color: #0044DD } /* Generic.Traceback */ -.listingblock .pygments .tok-kc { color: #AA22FF; font-weight: bold } /* Keyword.Constant */ -.listingblock .pygments .tok-kd { color: #AA22FF; font-weight: bold } /* Keyword.Declaration */ -.listingblock .pygments .tok-kn { color: #AA22FF; font-weight: bold } /* Keyword.Namespace */ -.listingblock .pygments .tok-kp { color: #AA22FF } /* Keyword.Pseudo */ -.listingblock .pygments .tok-kr { color: #AA22FF; font-weight: bold } /* Keyword.Reserved */ -.listingblock .pygments .tok-kt { color: #00BB00; font-weight: bold } /* Keyword.Type */ -.listingblock .pygments .tok-m { color: #666666 } /* Literal.Number */ -.listingblock .pygments .tok-s { color: #BB4444 } /* Literal.String */ -.listingblock .pygments .tok-na { color: #BB4444 } /* Name.Attribute */ -.listingblock .pygments .tok-nb { color: #AA22FF } /* Name.Builtin */ -.listingblock .pygments .tok-nc { color: #0000FF } /* Name.Class */ -.listingblock .pygments .tok-no { color: #880000 } /* Name.Constant */ -.listingblock .pygments .tok-nd { color: #AA22FF } /* Name.Decorator */ -.listingblock .pygments .tok-ni { color: #999999; font-weight: bold } /* Name.Entity */ -.listingblock .pygments .tok-ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -.listingblock .pygments .tok-nf { color: #00A000 } /* Name.Function */ -.listingblock .pygments .tok-nl { color: #A0A000 } /* Name.Label */ -.listingblock .pygments .tok-nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -.listingblock .pygments .tok-nt { color: #008000; font-weight: bold } /* Name.Tag */ -.listingblock .pygments .tok-nv { color: #B8860B } /* Name.Variable */ -.listingblock .pygments .tok-ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -.listingblock .pygments .tok-w { color: #bbbbbb } /* Text.Whitespace */ -.listingblock .pygments .tok-mb { color: #666666 } /* Literal.Number.Bin */ -.listingblock .pygments .tok-mf { color: #666666 } /* Literal.Number.Float */ -.listingblock .pygments .tok-mh { color: #666666 } /* Literal.Number.Hex */ -.listingblock .pygments .tok-mi { color: #666666 } /* Literal.Number.Integer */ -.listingblock .pygments .tok-mo { color: #666666 } /* Literal.Number.Oct */ -.listingblock .pygments .tok-sa { color: #BB4444 } /* Literal.String.Affix */ -.listingblock .pygments .tok-sb { color: #BB4444 } /* Literal.String.Backtick */ -.listingblock .pygments .tok-sc { color: #BB4444 } /* Literal.String.Char */ -.listingblock .pygments .tok-dl { color: #BB4444 } /* Literal.String.Delimiter */ -.listingblock .pygments .tok-sd { color: #BB4444; font-style: italic } /* Literal.String.Doc */ -.listingblock .pygments .tok-s2 { color: #BB4444 } /* Literal.String.Double */ -.listingblock .pygments .tok-se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -.listingblock .pygments .tok-sh { color: #BB4444 } /* Literal.String.Heredoc */ -.listingblock .pygments .tok-si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -.listingblock .pygments .tok-sx { color: #008000 } /* Literal.String.Other */ -.listingblock .pygments .tok-sr { color: #BB6688 } /* Literal.String.Regex */ -.listingblock .pygments .tok-s1 { color: #BB4444 } /* Literal.String.Single */ -.listingblock .pygments .tok-ss { color: #B8860B } /* Literal.String.Symbol */ -.listingblock .pygments .tok-bp { color: #AA22FF } /* Name.Builtin.Pseudo */ -.listingblock .pygments .tok-fm { color: #00A000 } /* Name.Function.Magic */ -.listingblock .pygments .tok-vc { color: #B8860B } /* Name.Variable.Class */ -.listingblock .pygments .tok-vg { color: #B8860B } /* Name.Variable.Global */ -.listingblock .pygments .tok-vi { color: #B8860B } /* Name.Variable.Instance */ -.listingblock .pygments .tok-vm { color: #B8860B } /* Name.Variable.Magic */ -.listingblock .pygments .tok-il { color: #666666 } /* Literal.Number.Integer.Long */ +.listingblock .pygments, .highlight pre { + background: #f8f8f8; + + .hll { background-color: #ffffcc } + .c, .tok-c { color: #008800; font-style: italic } /* Comment */ + .err, .tok-err { border: 1px solid #FF0000 } /* Error */ + .k, .tok-k { color: #AA22FF; font-weight: bold } /* Keyword */ + .o, .tok-o { color: #666666 } /* Operator */ + .ch, .tok-ch { color: #008800; font-style: italic } /* Comment.Hashbang */ + .cm, .tok-cm { color: #008800; font-style: italic } /* Comment.Multiline */ + .cp, .tok-cp { color: #008800 } /* Comment.Preproc */ + .cpf, .tok-cpf { color: #008800; font-style: italic } /* Comment.PreprocFile */ + .c1, .tok-c1 { color: #008800; font-style: italic } /* Comment.Single */ + .cs, .tok-cs { color: #008800; font-weight: bold } /* Comment.Special */ + .gd, .tok-gd { color: #A00000 } /* Generic.Deleted */ + .ge, .tok-ge { font-style: italic } /* Generic.Emph */ + .gr, .tok-gr { color: #FF0000 } /* Generic.Error */ + .gh, .tok-gh { color: #000080; font-weight: bold } /* Generic.Heading */ + .gi, .tok-gi { color: #00A000 } /* Generic.Inserted */ + .go, .tok-go { color: #888888 } /* Generic.Output */ + .gp, .tok-gp { color: #000080; font-weight: bold } /* Generic.Prompt */ + .gs, .tok-gs { font-weight: bold } /* Generic.Strong */ + .gu, .tok-gu { color: #800080; font-weight: bold } /* Generic.Subheading */ + .gt, .tok-gt { color: #0044DD } /* Generic.Traceback */ + .kc, .tok-kc { color: #AA22FF; font-weight: bold } /* Keyword.Constant */ + .kd, .tok-kd { color: #AA22FF; font-weight: bold } /* Keyword.Declaration */ + .kn, .tok-kn { color: #AA22FF; font-weight: bold } /* Keyword.Namespace */ + .kp, .tok-kp { color: #AA22FF } /* Keyword.Pseudo */ + .kr, .tok-kr { color: #AA22FF; font-weight: bold } /* Keyword.Reserved */ + .kt, .tok-kt { color: #00BB00; font-weight: bold } /* Keyword.Type */ + .m, .tok-m { color: #666666 } /* Literal.Number */ + .s, .tok-s { color: #BB4444 } /* Literal.String */ + .na, .tok-na { color: #BB4444 } /* Name.Attribute */ + .nb, .tok-nb { color: #AA22FF } /* Name.Builtin */ + .nc, .tok-nc { color: #0000FF } /* Name.Class */ + .no, .tok-no { color: #880000 } /* Name.Constant */ + .nd, .tok-nd { color: #AA22FF } /* Name.Decorator */ + .ni, .tok-ni { color: #999999; font-weight: bold } /* Name.Entity */ + .ne, .tok-ne { color: #D2413A; font-weight: bold } /* Name.Exception */ + .nf, .tok-nf { color: #00A000 } /* Name.Function */ + .nl, .tok-nl { color: #A0A000 } /* Name.Label */ + .nn, .tok-nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ + .nt, .tok-nt { color: #008000; font-weight: bold } /* Name.Tag */ + .nv, .tok-nv { color: #B8860B } /* Name.Variable */ + .ow, .tok-ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ + .w, .tok-w { color: #bbbbbb } /* Text.Whitespace */ + .mb, .tok-mb { color: #666666 } /* Literal.Number.Bin */ + .mf, .tok-mf { color: #666666 } /* Literal.Number.Float */ + .mh, .tok-mh { color: #666666 } /* Literal.Number.Hex */ + .mi, .tok-mi { color: #666666 } /* Literal.Number.Integer */ + .mo, .tok-mo { color: #666666 } /* Literal.Number.Oct */ + .sa, .tok-sa { color: #BB4444 } /* Literal.String.Affix */ + .sb, .tok-sb { color: #BB4444 } /* Literal.String.Backtick */ + .sc, .tok-sc { color: #BB4444 } /* Literal.String.Char */ + .dl, .tok-dl { color: #BB4444 } /* Literal.String.Delimiter */ + .sd, .tok-sd { color: #BB4444; font-style: italic } /* Literal.String.Doc */ + .s2, .tok-s2 { color: #BB4444 } /* Literal.String.Double */ + .se, .tok-se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ + .sh, .tok-sh { color: #BB4444 } /* Literal.String.Heredoc */ + .si, .tok-si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ + .sx, .tok-sx { color: #008000 } /* Literal.String.Other */ + .sr, .tok-sr { color: #BB6688 } /* Literal.String.Regex */ + .s1, .tok-s1 { color: #BB4444 } /* Literal.String.Single */ + .ss, .tok-ss { color: #B8860B } /* Literal.String.Symbol */ + .bp, .tok-bp { color: #AA22FF } /* Name.Builtin.Pseudo */ + .fm, .tok-fm { color: #00A000 } /* Name.Function.Magic */ + .vc, .tok-vc { color: #B8860B } /* Name.Variable.Class */ + .vg, .tok-vg { color: #B8860B } /* Name.Variable.Global */ + .vi, .tok-vi { color: #B8860B } /* Name.Variable.Instance */ + .vm, .tok-vm { color: #B8860B } /* Name.Variable.Magic */ + .il, .tok-il { color: #666666 } /* Literal.Number.Integer.Long */ +} -- cgit v1.1