forked from ionic-team/ionic-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4195c94
commit dea9867
Showing
8 changed files
with
153 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
import marked from 'marked'; | ||
export default (markdownString) => marked(markdownString); | ||
import hljs from 'highlight.js'; | ||
|
||
const renderer = new marked.Renderer(); | ||
|
||
renderer.code = (code: string, lang = '') => | ||
`<docs-code language="${lang}">${hljs.highlightAuto(code, [lang]).value}</docs-code>`; | ||
|
||
export default (markdownString) => marked(markdownString, { renderer }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
@import './highlight-theme.css'; | ||
|
||
docs-code { | ||
display: block; | ||
} | ||
|
||
docs-code pre { | ||
position: relative; | ||
} | ||
|
||
docs-code pre:before { | ||
color: #bdc5d1; | ||
content: attr(data-language); | ||
font-family: var(--code-font-family); | ||
font-size: 11px; | ||
letter-spacing: 0.05em; | ||
padding: 0.65em; | ||
position: absolute; | ||
right: 0; | ||
text-transform: uppercase; | ||
top: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Component, Prop } from '@stencil/core'; | ||
|
||
@Component({ | ||
tag: 'docs-code', | ||
styleUrl: 'code.css' | ||
}) | ||
export class DocsCode { | ||
@Prop() language = ''; | ||
|
||
render() { | ||
return ( | ||
<pre data-language={this.language}><code><slot/></code></pre> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ | ||
|
||
/* Tomorrow Comment */ | ||
.hljs-comment, | ||
.hljs-quote { | ||
color: #8c9296; | ||
} | ||
|
||
/* Tomorrow Red */ | ||
.hljs-variable, | ||
.hljs-template-variable, | ||
.hljs-name, | ||
.hljs-selector-id, | ||
.hljs-selector-class, | ||
.hljs-regexp, | ||
.hljs-deletion { | ||
color: #2b90ff; | ||
} | ||
|
||
.hljs-tag { | ||
color: #91c5ff; | ||
} | ||
|
||
.hljs-tag .hljs-name { | ||
color: #2b90ff; | ||
} | ||
|
||
/* Tomorrow Orange */ | ||
.hljs-number, | ||
.hljs-built_in, | ||
.hljs-builtin-name, | ||
.hljs-literal, | ||
.hljs-type, | ||
.hljs-params, | ||
.hljs-meta, | ||
.hljs-link { | ||
color: #ff6810; | ||
} | ||
|
||
/* Tomorrow Yellow */ | ||
.hljs-attribute, | ||
.hljs-attr { | ||
color: #8454ff; | ||
} | ||
|
||
/* Tomorrow Green */ | ||
.hljs-string, | ||
.hljs-symbol, | ||
.hljs-bullet, | ||
.hljs-addition, | ||
.hljs-string a { | ||
color: #42b983; | ||
} | ||
|
||
/* Tomorrow Blue */ | ||
.hljs-title, | ||
.hljs-section { | ||
color: #ffbb01; | ||
} | ||
|
||
/* Tomorrow Purple */ | ||
.hljs-keyword, | ||
.hljs-selector-tag { | ||
color: #f55073; | ||
} | ||
|
||
.hljs { | ||
display: block; | ||
overflow-x: auto; | ||
background: white; | ||
color: #4d4d4c; | ||
padding: 0.5em; | ||
} | ||
|
||
.hljs-emphasis { | ||
font-style: italic; | ||
} | ||
|
||
.hljs-strong { | ||
font-weight: bold; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters