提交 d9ac270b 编写于 作者: E Evan You

theme styling

上级 719003f3
# Configuration # Configuration
## `.vuepress/config.js` ## .vuepress/config.js
### base ### base
...@@ -22,4 +22,4 @@ ...@@ -22,4 +22,4 @@
### evergreen ### evergreen
## Browser Compatibility ## Note on Browser Compatibility
...@@ -42,7 +42,7 @@ meta: ...@@ -42,7 +42,7 @@ meta:
**Input** **Input**
``` markdown ```
[[toc]] [[toc]]
``` ```
...@@ -54,7 +54,7 @@ meta: ...@@ -54,7 +54,7 @@ meta:
**Input** **Input**
``` markdown ```
::: tip ::: tip
This is a tip This is a tip
::: :::
...@@ -86,7 +86,7 @@ This is a dangerous thing ...@@ -86,7 +86,7 @@ This is a dangerous thing
**Input** **Input**
```` markdown ````
``` js{4} ``` js{4}
export default { export default {
data () { data () {
...@@ -114,7 +114,7 @@ export default { ...@@ -114,7 +114,7 @@ export default {
**Input** **Input**
``` markdown ```
:tada: :100: :tada: :100:
``` ```
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
## Templating ## Templating
### Interpolation
Each markdown file is first compiled into HTML and then passed on as a Vue component to `vue-loader`. This means you can use Vue-style interpolation in text: Each markdown file is first compiled into HTML and then passed on as a Vue component to `vue-loader`. This means you can use Vue-style interpolation in text:
**Input** **Input**
...@@ -14,6 +16,8 @@ Each markdown file is first compiled into HTML and then passed on as a Vue compo ...@@ -14,6 +16,8 @@ Each markdown file is first compiled into HTML and then passed on as a Vue compo
<pre><code>{{ 1 + 1 }}</code></pre> <pre><code>{{ 1 + 1 }}</code></pre>
### Directives
Directives also work: Directives also work:
**Input** **Input**
...@@ -26,6 +30,8 @@ Directives also work: ...@@ -26,6 +30,8 @@ Directives also work:
<pre><code><span v-for="i in 3">{{ i }} </span></code></pre> <pre><code><span v-for="i in 3">{{ i }} </span></code></pre>
### Access to Site & Page Data
The compiled component does not have any private data but do have access to the [site metadata](./theming.md#site-and-page-metadata). For example: The compiled component does not have any private data but do have access to the [site metadata](./theming.md#site-and-page-metadata). For example:
**Input** **Input**
......
.theme-container .theme-container
font-family -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif font-family -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif
-webkit-font-smoothing antialiased
-moz-osx-font-smoothing grayscale
padding 0 30px padding 0 30px
font-size 16px
color #2c3e50
blockquote
font-size 1.25em
color #999
border-left .25em solid #dfe2e5
margin-left 0
padding-left 1em
ul, ol
padding-left 1.5em
a a
color #41b883 color #41b883
text-decoration none text-decoration none
strong
font-weight 600
h1, h2, h3, h4, h5, h6 h1, h2, h3, h4, h5, h6
font-weight 600
line-height 1.25
&:not(:first-child)
margin-top 1.5em
&:hover .header-anchor &:hover .header-anchor
opacity: 1 opacity: 1
h1
font-size 2.3em
h2
font-size 1.8em
padding-bottom .3em
border-bottom 1px solid #eaecef
h3
font-size 1.4em
a.header-anchor a.header-anchor
font-size 0.8em font-size 0.85em
float left float left
padding-right 4px margin-left -0.87em
margin-left -20px padding-right 0.23em
margin-top 3px margin-top 0.125em
opacity 0 opacity 0
code
font-family source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace
p, ul, ol
line-height 1.5
p, h1, h2, h3, h4, h5, h6
code
padding 0.2em 0.5em
margin 0
font-size 0.85em
background-color rgba(27,31,35,0.05)
border-radius 3px
p code
color lighten(#2c3e50, 20%)
pre, pre[class*="language-"] pre, pre[class*="language-"]
background-color #2d2d2d background-color #2d2d2d
color white color white
...@@ -28,9 +77,7 @@ pre, pre[class*="language-"] ...@@ -28,9 +77,7 @@ pre, pre[class*="language-"]
word-break break-word word-break break-word
overflow auto overflow auto
code code
font-family source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace font-size .88em
font-size 14px
-webkit-font-smoothing antialiased
.highlighted-line .highlighted-line
background-color #14161a background-color #14161a
...@@ -39,14 +86,20 @@ pre, pre[class*="language-"] ...@@ -39,14 +86,20 @@ pre, pre[class*="language-"]
padding 0.2rem 1.575rem 0 padding 0.2rem 1.575rem 0
div div
&.tip, &.warning, &.danger
padding .1em 1.4em
border-left-width .5em
border-left-style solid
margin 1em 0
&.tip &.tip
color white background-color #f1f3f5
background-color green border-color #42b983
&.warning &.warning
background-color yellow background-color rgba(255,229,100,.3)
border-color #ffe564
&.danger &.danger
color white background-color #ffe6e6
background-color red border-color red
p p
&.demo &.demo
......
...@@ -8,10 +8,6 @@ const anchor = require('markdown-it-anchor') ...@@ -8,10 +8,6 @@ const anchor = require('markdown-it-anchor')
const container = require('markdown-it-container') const container = require('markdown-it-container')
const toc = require('markdown-it-table-of-contents') const toc = require('markdown-it-table-of-contents')
// TODO allow configuring markdown behavior
// TODO extract <style> blocks and <script> blocks
// TODO support inline demo
module.exports = ({ markdown = {}}) => { module.exports = ({ markdown = {}}) => {
const md = require('markdown-it')({ const md = require('markdown-it')({
html: true, html: true,
...@@ -27,7 +23,8 @@ module.exports = ({ markdown = {}}) => { ...@@ -27,7 +23,8 @@ module.exports = ({ markdown = {}}) => {
.use(emoji) .use(emoji)
.use(anchor, Object.assign({ .use(anchor, Object.assign({
permalink: true, permalink: true,
permalinkBefore: true // TODO use an svg? permalinkBefore: true,
permalinkSymbol: '#'
}, markdown.anchor)) }, markdown.anchor))
.use(toc, Object.assign({ .use(toc, Object.assign({
includeLevel: [2, 3] includeLevel: [2, 3]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册