Skip to content

Commit

Permalink
try to unfsck code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
cydave committed Apr 21, 2023
1 parent 41e4677 commit 9b701eb
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

A work in progress port of the [hugo-PaperMod](https://github.com/adityatelange/hugo-PaperMod) theme by [@adityatelange](https://github.com/adityatelange) to [Zola](https://www.getzola.org/)

Demo @ https://cydave.github.io/zola-theme-papermod-demo/
Demo @ https://cydave.github.io/zola-theme-papermod/
73 changes: 73 additions & 0 deletions content/posts/2023-04-21_syntax_highlighting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
+++
title = "Syntax highlighting"
+++

## Some examples

### TOML

```toml
[extra]
custom_url = "$BASE_URL/atom.xml"

[extra.papermod]
custom_url = "$BASE_URL/atom.xml"
title = "PaperMod"
default_theme = "auto"
theme = "light"
language_direction = "auto"
keywords = ["keyword1", "keyword2", "keyword3"]
disable_theme_toggle = false
show_code_copy_buttons = true
show_reading_time = true
show_word_count = false
show_post_nav_links = true
show_post_meta = true
default_toc_open = false
edit_post_url = "https://github.com/cydave/zola-theme-papermod/tree/master"
copyright = ""
date_format = "%Y-%m-%d"
```


### YAML

```yaml
- martin:
name: Martin D'vloper
job: Developer
skills:
- python
- perl
- pascal
- tabitha:
name: Tabitha Bitumen
job: Developer
skills:
- lisp
- fortran
- erlang
```
### With Line Numbers
```python,linenos,linenostart=98
class MockResponse:
"""Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`.
...what? Basically, expose the parsed HTTP headers from the server response
the way `cookielib` expects to see them.
"""

def __init__(self, headers):
"""Make a MockResponse for `cookielib` to read.
:param headers: a httplib.HTTPMessage or analogous carrying the headers
"""
self._headers = headers

def info(self):
return self._headers

def getheaders(self, name):
self._headers.getheaders(name)
```
49 changes: 49 additions & 0 deletions static/css/override.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
.post-content pre,
.post-content code,
.post-content pre code,
.post-content code table,
.post-content pre table,
.post-content table tr,
.post-content table th,
.post-content table td {
width: 100%;
border: 0;
border-spacing: 0;
margin: 0;
padding: 0;
}

.post-content pre,
.post-content pre code {
border-radius: 8px;
}


.post-content pre {
width: 100%;
overflow-x: auto;
word-break: break-all;
margin: 0;
padding: 0;
}

.post-content pre > code {
margin: 0;
padding: 15px;
display: block;
overflow-x: auto;
word-break: break-all;
}

.post-content pre code > table {
overflow-x: auto;
word-break: break-all;
}


.post-content pre table td:nth-of-type(1) {
text-align: right;
user-select: none;
white-space: nowrap;
padding: 0 26px 0 0px;
}
2 changes: 1 addition & 1 deletion static/css/styles.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions templates/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

<link rel="stylesheet" href="{{ get_url(path='css/includes/scroll-bar.css') }}">
<link rel="stylesheet" href="{{ get_url(path='css/styles.css') }}">
<link rel="stylesheet" href="{{ get_url(path='css/override.css') }}">

{# /* Favicons */}
<link rel="icon" href="{{ site.Params.assets.favicon | default "favicon.ico" | absURL }}">
Expand Down

0 comments on commit 9b701eb

Please sign in to comment.