Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#441 add initial version of styles for JS highlighting #444

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions demo_docs/source/code_examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Code examples
============

JavaScript
----------

.. code-block:: js

/*comment*/
// comment
/*
* comment
*/
const test = /\w+/
const defg = 'defg'
const testObject = {
object: 'test',
object2: 'test2',
defg
}
const testArray = [...testObject]
['array', "array"]
let arrowFunction = x => x * 2
var data = new Date()
const that = this
let testTemplateString = `abc${defg}`
export default that

$(document).ready(function() {
$(document).keyup(function(event) {
var activeElementType = document.activeElement.tagName;
// don't navigate when in search box or textarea
if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') {
switch (event.keyCode) {
case 37: // left
var prevHref = $('link[rel="prev"]').prop('href');
if (prevHref) {
window.location.href = prevHref;
return false;
}
case 39: // right
var nextHref = $('link[rel="next"]').prop('href');
if (nextHref) {
window.location.href = nextHref;
return false;
}
}
}
});
});
1 change: 1 addition & 0 deletions demo_docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Contents
demo
lists_tables
api
code_examples

.. toctree::
:maxdepth: 3
Expand Down
33 changes: 33 additions & 0 deletions sass/_theme_js_highlight.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.highlight-js
//pre
background-color: #282c34
// keywords: var, let, (const: if fixed in Pygments)
span.kd
color: #c678dd
// keywords: export, (const: if not fixed in Pygments)
span.kr
color: #c678dd
// names
// span.nx
color: #61afef
// operators (missing: arrows =>)
span.o
color: #56b6c2
// strings: single quote, double quote, template
span.s1, span.s2, span.sb
color: #98c379
// numbers
span.mi
color: #d19a66
// brackets/parenthesis
span.p
color: #abb2bf
// keywords: new, this, default, switch, case...
span.k
color: #e06c75
// boolean
span.kc
color: #d19a66
// global variable: window
span.nb
color: #e06c75
1 change: 1 addition & 0 deletions sass/theme.sass
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
@import theme_layout
@import theme_badge
@import theme_rst
@import theme_js_highlight
@import theme_mathjax
@import theme_font_awesome_compatibility
@import theme_font_local
221 changes: 220 additions & 1 deletion sphinx_rtd_theme/static/css/badge_only.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sphinx_rtd_theme/static/css/badge_only.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading