Skip to content

Commit

Permalink
feat: prettierrc格式化
Browse files Browse the repository at this point in the history
  • Loading branch information
dntzhang committed Jan 1, 2024
1 parent d9a4251 commit 6f9dc56
Show file tree
Hide file tree
Showing 70 changed files with 1,015 additions and 651 deletions.
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"printWidth": 90,
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"proseWrap": "always",
"endOfLine": "auto"
}
22 changes: 22 additions & 0 deletions package-lock.json

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

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
"build": "tsc && vite build --base=./ && npm run cp-libs && npm run cp-sections",
"serve": "vite preview",
"cp-libs": "cp -r ./libs ./dist/libs",
"cp-sections": "cp -r ./src/sections ./dist/sections"
"cp-sections": "cp -r ./src/sections ./dist/sections",
"p": "prettier --write \"src/**/*.{ts,tsx,less,scss,css,js,json,html}\""
},
"devDependencies": {
"less": "^4.1.1",
"prettier": "3.1.1",
"sass": "^1.37.5",
"typescript": "^4.3.2",
"vite": "^2.9.14"
Expand All @@ -27,11 +29,11 @@
"markdown-it": "^13.0.1",
"markdown-it-anchor": "^8.6.4",
"omi": "^7.3.5",
"rspa": "^0.0.1",
"omi-transition": "^0.0.2",
"omi-twind": "^0.0.2",
"prismjs": "^1.28.0",
"rollup": "^2.77.0",
"rspa": "^0.0.1",
"typescript": "^4.6.4"
}
}
6 changes: 3 additions & 3 deletions src/assets/index.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
html,
body {
padding: 0;
margin: 0;
}
padding: 0;
margin: 0;
}
9 changes: 4 additions & 5 deletions src/components/markdown-docs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ export default class extends Component<Props> {

static defaultProps = {
mdContent: '',
padding: 0

padding: 0,
}

md
Expand All @@ -47,7 +46,7 @@ export default class extends Component<Props> {
// @ts-ignore
this.md = new MdIt().use(anchor.default, {
level: 2,
permalink: true
permalink: true,
})
}

Expand Down Expand Up @@ -91,8 +90,8 @@ export default class extends Component<Props> {
render() {
return (
<div class="result-html" style={{ padding: this.props.padding }}>
<div unsafeHTML={this.md.render(this.props.mdContent)}></div >
</div >
<div unsafeHTML={this.md.render(this.props.mdContent)}></div>
</div>
)
}
}
10 changes: 3 additions & 7 deletions src/components/md.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

.source {
width: 100%;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
font-size: 12px;
padding: 2px;
}
Expand All @@ -26,7 +26,6 @@
max-width: 950px;
margin: 0 auto;
background-color: #fff;

}

.result-html img {
Expand Down Expand Up @@ -123,7 +122,7 @@
width: 230px;
z-index: 10000;
white-space: nowrap;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
background-color: #686868;
box-shadow: 0 0 2px rgba(102, 102, 102, 0.4);
padding: 1px 0;
Expand Down Expand Up @@ -160,7 +159,6 @@
width: auto;
}


.result-html {
font-size: 0.875em;
}
Expand Down Expand Up @@ -221,12 +219,10 @@ h2 {
font-size: 1.3em;
}


h3 {
font-size: 1.2em;
}


h4 {
font-size: 1.1em;
}
Expand All @@ -237,4 +233,4 @@ h5 {

h6 {
font-size: 0.9em;
}
}
51 changes: 26 additions & 25 deletions src/components/prism.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ https://prismjs.com/download.html#themes=prism-okaidia&languages=markup+css+clik
* @author ocodia
*/

code[class*="language-"],
pre[class*="language-"] {
code[class*='language-'],
pre[class*='language-'] {
color: #f8f8f2;
background: none;
text-shadow: 0 1px rgba(0, 0, 0, 0.3);
Expand All @@ -27,27 +27,25 @@ pre[class*="language-"] {
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;

}

/* Code blocks */
pre[class*="language-"] {
pre[class*='language-'] {
padding: 1em;
margin: 0;
overflow: auto;
border-radius: 0.5em;

}

:not(pre)>code[class*="language-"],
pre[class*="language-"] {
:not(pre) > code[class*='language-'],
pre[class*='language-'] {
background: #214247;
}

/* Inline code */
:not(pre)>code[class*="language-"] {
padding: .1em;
border-radius: .3em;
:not(pre) > code[class*='language-'] {
padding: 0.1em;
border-radius: 0.3em;
white-space: normal;
}

Expand All @@ -63,7 +61,7 @@ pre[class*="language-"] {
}

.namespace {
opacity: .7;
opacity: 0.7;
}

.token.property,
Expand Down Expand Up @@ -139,8 +137,12 @@ pre[data-line] {
margin-top: 1em;
/* Same as .prism’s padding-top */

background: hsla(24, 20%, 50%, .08);
background: linear-gradient(to right, hsla(24, 20%, 50%, .1) 70%, hsla(24, 20%, 50%, 0));
background: hsla(24, 20%, 50%, 0.08);
background: linear-gradient(
to right,
hsla(24, 20%, 50%, 0.1) 70%,
hsla(24, 20%, 50%, 0)
);

pointer-events: none;

Expand All @@ -152,15 +154,15 @@ pre[data-line] {
.line-highlight[data-end]:after {
content: attr(data-start);
position: absolute;
top: .4em;
left: .6em;
top: 0.4em;
left: 0.6em;
min-width: 1em;
padding: 0 .5em;
background-color: hsla(24, 20%, 50%, .4);
padding: 0 0.5em;
background-color: hsla(24, 20%, 50%, 0.4);
color: hsl(24, 20%, 95%);
font: bold 65%/1.5 sans-serif;
text-align: center;
vertical-align: .3em;
vertical-align: 0.3em;
border-radius: 999px;
text-shadow: none;
box-shadow: 0 1px white;
Expand All @@ -169,21 +171,21 @@ pre[data-line] {
.line-highlight[data-end]:after {
content: attr(data-end);
top: auto;
bottom: .4em;
bottom: 0.4em;
}

.line-numbers .line-highlight:before,
.line-numbers .line-highlight:after {
content: none;
}

pre[class*="language-"].line-numbers {
pre[class*='language-'].line-numbers {
position: relative;
padding-left: 3.8em;
counter-reset: linenumber;
}

pre[class*="language-"].line-numbers>code {
pre[class*='language-'].line-numbers > code {
position: relative;
white-space: inherit;
}
Expand All @@ -203,19 +205,18 @@ pre[class*="language-"].line-numbers>code {
-moz-user-select: none;
-ms-user-select: none;
user-select: none;

}

.line-numbers-rows>span {
.line-numbers-rows > span {
pointer-events: none;
display: block;
counter-increment: linenumber;
}

.line-numbers-rows>span:before {
.line-numbers-rows > span:before {
content: counter(linenumber);
color: #999;
display: block;
padding-right: 0.8em;
text-align: right;
}
}
4 changes: 2 additions & 2 deletions src/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
'./a.css': 'h1{color: red}'
*/
export const files = {
'./index': ''
}
'./index': '',
}
2 changes: 1 addition & 1 deletion src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ declare module '*.less'
declare module '*.css'
declare module '*.scss'
declare module '*.sass'
declare module '*.webp'
declare module '*.webp'
Loading

0 comments on commit 6f9dc56

Please sign in to comment.