Skip to content

Commit 5c3c8b1

Browse files
KyleKingkernc
authored andcommittedFeb 25, 2019
ENH: Configurable highlight style (pdoc3#38)
* Refac: Atom One Light hljs style & css tweaks * Revert: CSS previous changes. Only keep 12px code * Add: configurable hljs style. Fixes pdoc3#34 * Rename config.mako option to `hljs_style`
1 parent 24a561c commit 5c3c8b1

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
dist
22
build
3+
*.eggs/*
34
*.egg-info
45
*.py[cod]
56

‎pdoc/templates/config.mako

+4
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@
55
extract_module_toc_into_sidebar = True
66
list_class_variables_in_index = True
77
sort_identifiers = True
8+
# Set the style keyword such as 'atom-one-light' or 'github-gist'
9+
# Options: https://github.com/highlightjs/highlight.js/tree/master/src/styles
10+
# Demo: https://highlightjs.org/static/demo/
11+
hljs_style = 'github'
812
%>

‎pdoc/templates/css.mako

+1
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@
213213
margin: 0;
214214
}
215215
.source pre code {
216+
font-size: 12px;
216217
overflow: visible;
217218
}
218219
.hlist {

‎pdoc/templates/html.mako

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
extract_module_toc_into_sidebar = getattr(config.attr, 'extract_module_toc_into_sidebar', True)
2626
list_class_variables_in_index = getattr(config.attr, 'list_class_variables_in_index', False)
2727
sort_identifiers = getattr(config.attr, 'sort_identifiers', True)
28+
hljs_style = getattr(config.attr, 'hljs_style', 'github')
2829
2930
link = getattr(config.attr, 'link', link)
3031
to_html = getattr(config.attr, 'to_html', to_html)
@@ -350,7 +351,7 @@
350351
<link href='https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css' rel='stylesheet'>
351352
<link href='https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/8.0.0/sanitize.min.css' rel='stylesheet'>
352353
% if show_source_code:
353-
<link href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css" rel="stylesheet">
354+
<link href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/${hljs_style}.min.css" rel="stylesheet">
354355
%endif
355356

356357
<%namespace name="css" file="css.mako" />

0 commit comments

Comments
 (0)