Skip to content

Commit

Permalink
fix!: disable basic styling by default (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu authored Jun 16, 2022
1 parent c478868 commit 91d51f8
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 760 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
"markdown-it": "^13.0.1"
},
"devDependencies": {
"@antfu/utils": "^0.5.2",
"@antfu/eslint-config": "^0.25.1",
"@antfu/ni": "^0.16.2",
"@antfu/utils": "^0.5.2",
"@cypress/vite-dev-server": "^2.2.3",
"@cypress/vue": "^3.1.2",
"@types/markdown-it": "^12.2.3",
Expand All @@ -76,12 +76,12 @@
"c8": "^7.11.3",
"callsites": "^3.1.0",
"cypress": "^9.7.0",
"prismjs": "^1.28.0",
"eslint": "^8.17.0",
"eslint-config-prettier": "^8.5.0",
"happy-dom": "^5.3.1",
"npm-run-all": "^4.1.5",
"pathe": "^0.3.0",
"prismjs": "^1.28.0",
"rollup": "^2.75.6",
"shiki": "^0.10.1",
"tsup": "^6.1.2",
Expand Down
3 changes: 1 addition & 2 deletions src/pipeline/composeSfcBlocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
} from '../types'
import {
applyMarkdownItOptions,
baseStyling,
convertToDom,
createParser,
escapeCodeTagInterpolation,
Expand Down Expand Up @@ -63,7 +62,7 @@ export async function composeSfcBlocks(id: string, raw: string, opts: Omit<Optio
/** extract the meta-data from the MD content */
const metaExtracted = flow(
extractFrontmatter,
baseStyling,
// baseStyling,
frontmatterPreprocess,
handlers(PipelineStage.metaExtracted),
)
Expand Down
51 changes: 1 addition & 50 deletions test/__snapshots__/dynamic-references.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,54 +7,5 @@ exports[`loading images and links from frontmatter props > snapshot test 1`] = `
<p><img src=\\"{{remoteCat}}\\" alt=\\"remote cat\\"></p>
<p>for more on cats, check out this link: <a href=\\"{{catLink}}\\">link</a></p>
<p>{{catLink}}</p>
</div><style type=\\"text/css\\">
:root {
--md-text-color: #111827;
--md-code-background: rgba(27,31,35,.05);
--code-font: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \\"Liberation Mono\\", \\"Courier New\\", monospace;
}
html.dark {
--md-text-color: #e5e7eb;
--md-code-background: rgba(229, 231, 235, 0.65);
}
.markdown-body {
color: var(--md-text-color);
}
.markdown-body code {
font-size: 85%;
padding: 0.2em 0.3em;
margin-left: 0.1rem;
margin-right: 0.1rem;
background-color: var(--md-code-background);
border-radius: 3px;
font-family: var(--code-font);
color: #333;
white-space: pre;
}
.markdown-body blockquote {
margin-top: 0;
margin-bottom: 0.25rem;
padding: 0 1em;
color: #6a73737d;
border-left: 0.25rem solid #dfe2e5;
}
.markdown-body a {
cursor: pointer;
}
.markdown-body a:hover {
background-color: rgba(0,0,0,.5);
font-weight: 700;
border-radius: 0.2rem 0.4rem;
}
</style>"
</div>"
`;
101 changes: 1 addition & 100 deletions test/__snapshots__/excerpt.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,110 +8,11 @@ exports[`excerpt snapshots > HTML is consistent 1`] = `
<li>B</li>
<li><strong>C</strong></li>
</ul>
</div><style type=\\"text/css\\">
:root {
--md-text-color: #111827;
--md-code-background: rgba(27,31,35,.05);
--code-font: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \\"Liberation Mono\\", \\"Courier New\\", monospace;
}
html.dark {
--md-text-color: #e5e7eb;
--md-code-background: rgba(229, 231, 235, 0.65);
}
.markdown-body {
color: var(--md-text-color);
}
.markdown-body code {
font-size: 85%;
padding: 0.2em 0.3em;
margin-left: 0.1rem;
margin-right: 0.1rem;
background-color: var(--md-code-background);
border-radius: 3px;
font-family: var(--code-font);
color: #333;
white-space: pre;
}
.markdown-body blockquote {
margin-top: 0;
margin-bottom: 0.25rem;
padding: 0 1em;
color: #6a73737d;
border-left: 0.25rem solid #dfe2e5;
}
.markdown-body a {
cursor: pointer;
}
.markdown-body a:hover {
background-color: rgba(0,0,0,.5);
font-weight: 700;
border-radius: 0.2rem 0.4rem;
}
</style>"
</div>"
`;
exports[`excerpt snapshots > custom blocks are consistent 1`] = `
[
"<style type=\\"text/css\\">
:root {
--md-text-color: #111827;
--md-code-background: rgba(27,31,35,.05);
--code-font: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \\"Liberation Mono\\", \\"Courier New\\", monospace;
}
html.dark {
--md-text-color: #e5e7eb;
--md-code-background: rgba(229, 231, 235, 0.65);
}
.markdown-body {
color: var(--md-text-color);
}
.markdown-body code {
font-size: 85%;
padding: 0.2em 0.3em;
margin-left: 0.1rem;
margin-right: 0.1rem;
background-color: var(--md-code-background);
border-radius: 3px;
font-family: var(--code-font);
color: #333;
white-space: pre;
}
.markdown-body blockquote {
margin-top: 0;
margin-bottom: 0.25rem;
padding: 0 1em;
color: #6a73737d;
border-left: 0.25rem solid #dfe2e5;
}
.markdown-body a {
cursor: pointer;
}
.markdown-body a:hover {
background-color: rgba(0,0,0,.5);
font-weight: 700;
border-radius: 0.2rem 0.4rem;
}
</style>",
"<route lang=\\"json\\">{}</route>
",
]
Expand Down
Loading

0 comments on commit 91d51f8

Please sign in to comment.