Skip to content

Commit

Permalink
fix: 样式修改
Browse files Browse the repository at this point in the history
  • Loading branch information
zuofenghua committed Aug 27, 2020
1 parent b692303 commit 0094bf7
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/client/theme-default/index.ts
Expand Up @@ -2,6 +2,7 @@ import './styles/vars.css'
import './styles/layout.css'
import './styles/code.css'
import './styles/custom-blocks.css'
import './styles/markdown.css'

import Layout from './Layout.vue'
import NotFound from './NotFound.vue'
Expand Down
20 changes: 20 additions & 0 deletions src/client/theme-default/styles/markdown.css
@@ -0,0 +1,20 @@
table {
width: 100%;
border-collapse: collapse;
border: 1px solid #ebedf1;
}

table th {
font-weight: 600;
background: #f9fafb;
}

table td:first-child {
font-weight: 500;
}

table td,
table th {
padding: 10px 24px;
border: 1px solid #ebedf1;
}
2 changes: 1 addition & 1 deletion src/client/theme-default/styles/vars.css
Expand Up @@ -2,7 +2,7 @@
--border-color: #ebedf1;
--header-height: 4rem;
--sidebar-width: 20rem;
--text-color: #2c3e50;
--text-color: #454d64;
--text-color-light: #476582;
--code-bg-color: #f9fafb;
--accent-color: #3eaf7c;
Expand Down
10 changes: 10 additions & 0 deletions src/node/markdown/plugins/demo.ts
Expand Up @@ -3,6 +3,15 @@ import { MarkdownParsedData } from '../markdown'
import fs from 'fs'
import path from 'path'
import { highlight } from './highlight'
// import matter from 'gray-matter'

// interface DemoProps {
// componentName: string,
// htmlStr: string,
// codeStr: string,
// title?: string,
// desc?: string,
// }

let index = 1
// hoist <script> and <style> tags out of the returned html
Expand Down Expand Up @@ -38,6 +47,7 @@ export const demoPlugin = (md: MarkdownIt) => {

console.log(`srcPath=${srcPath}`)
const codeStr = fs.readFileSync(srcPath).toString()
// const { content: codeContent, data: frontmatter } = matter(codeStr)
const htmlStr = encodeURIComponent(highlight(codeStr, language))

hoistedTags.script!.unshift(`import ${componentName} from '${src}' \n`)
Expand Down
4 changes: 2 additions & 2 deletions src/node/markdownToVue.ts
Expand Up @@ -61,8 +61,8 @@ export function createMarkdownToVueRenderFn(
}

const vueSrc =
`<script>${data.hoistedTags.script?.join('\n')}</script>` +
`<style>${data.hoistedTags.style?.join('\n')}</style>` +
`<script>${(data.hoistedTags.script ?? []).join('\n')}</script>` +
`<style>${(data.hoistedTags.style ?? []).join('\n')}</style>` +
`\n<template><div>${html}</div></template>`

debug(`[render] ${file} in ${Date.now() - start}ms.`)
Expand Down

0 comments on commit 0094bf7

Please sign in to comment.