1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-07-24 15:49:42 +02:00

Code tool updated (#45)

This commit is contained in:
Peter Savchenko 2019-02-18 10:42:12 +03:00 committed by GitHub
parent 1895fdceaa
commit a4031f151f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 51 additions and 43 deletions

View file

@ -1,6 +1,7 @@
import hljs from 'highlight.js/lib/highlight';
import javascript from 'highlight.js/lib/languages/javascript';
import style from 'highlight.js/styles/github-gist.css';
import xml from 'highlight.js/lib/languages/xml';
import style from 'highlight.js/styles/atom-one-dark.css';
/**
* @class CodeStyles
@ -11,11 +12,12 @@ export default class CodeStyler {
* @param {string} selector - CSS selector for code blocks
* @param {string[]} languages - list of languages to highlight, see hljs.listLanguages()
*/
constructor({selector, languages = [ 'javascript' ]}) {
constructor({selector, languages = [ 'javascript', 'xml' ]}) {
this.codeBlocksSelector = selector;
this.languages = languages;
this.langsAvailable = {
javascript
javascript,
xml
};
this.init();

View file

@ -57,20 +57,20 @@ export default class Editor {
class: CodeTool,
shortcut: 'CMD+SHIFT+D'
},
inlineCode: {
class: InlineCode,
shortcut: 'CMD+SHIFT+C'
},
rawTool: {
class: RawTool,
shortcut: 'CMD+SHIFT+R'
},
delimiter: Delimiter,
embed: Embed,
inlineCode: {
class: InlineCode,
shortcut: 'CMD+SHIFT+C'
},
marker: {
class: Marker,
shortcut: 'CMD+SHIFT+M'
},
delimiter: Delimiter,
embed: Embed
}
},
data: {
blocks: [

View file

@ -53,6 +53,11 @@
letter-spacing: -0.04px;
margin-bottom: -0.2em;
}
.cdx-marker {
background: rgba(245,235,111,0.33);
padding: 3px 0;
}
}
/**
@ -79,9 +84,9 @@
*/
.block-code {
padding: 20px !important;
border-radius: 3px;
border-radius: 5px;
font-size: 13px;
border: 1px solid var(--color-line-gray);
//border: 1px solid var(--color-line-gray);
font-family: Menlo,Monaco,Consolas,Courier New,monospace;
line-height: 1.7em;
}

View file

@ -1 +1,2 @@
<pre class="block-code">{{ code }}</pre>
<pre class="block-code">{{ code|escape }}</pre>

View file

@ -7,11 +7,11 @@
}
</style>
<section data-module="writing">
<module-settings hidden>
<textarea name="module-settings" hidden>
{
"page": {{ page | json_encode }}
}
</module-settings>
</textarea>
<header class="writing-header">
<span class="writing-header__left">
<span>