-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugin-markdown-ext): add styles for footnote and tasklist
- Loading branch information
1 parent
9734a37
commit 4171e82
Showing
7 changed files
with
153 additions
and
36 deletions.
There are no files selected for viewing
This file was deleted.
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
18 changes: 18 additions & 0 deletions
18
plugins/markdown/plugin-markdown-ext/src/client/styles/footnote.scss
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,18 @@ | ||
// footnote anchor position | ||
.footnote-item { | ||
margin-top: calc(0rem - var(--header-offset, 3.6rem)); | ||
padding-top: calc(var(--header-offset, 3.6rem) + 0.5rem); | ||
|
||
> p { | ||
margin-bottom: 0; | ||
} | ||
} | ||
|
||
.footnote-ref { | ||
position: relative; | ||
} | ||
|
||
.footnote-anchor { | ||
position: absolute; | ||
top: calc(-0.5rem - var(--header-offset, 3.6rem)); | ||
} |
90 changes: 90 additions & 0 deletions
90
plugins/markdown/plugin-markdown-ext/src/client/styles/tasklist.scss
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,90 @@ | ||
.task-list-container { | ||
padding-inline-start: 0; | ||
list-style-position: inside; | ||
|
||
.task-list-container { | ||
padding-inline-start: 1.5em; | ||
} | ||
} | ||
|
||
.task-list-item { | ||
list-style: none; | ||
} | ||
|
||
.task-list-item-checkbox { | ||
position: relative; | ||
|
||
vertical-align: text-bottom; | ||
|
||
height: 1em; | ||
margin-inline-end: 1.5em; | ||
|
||
cursor: pointer; | ||
|
||
appearance: none; | ||
|
||
&::after { | ||
content: ' '; | ||
|
||
position: absolute; | ||
top: 0; | ||
|
||
display: inline-block; | ||
|
||
box-sizing: border-box; | ||
width: 1em; | ||
height: 1em; | ||
padding-inline-start: 0; | ||
border: 1px solid var(--vp-c-border); | ||
border-radius: 2px; | ||
|
||
background: var(--vp-c-control); | ||
|
||
text-align: center; | ||
|
||
visibility: visible; | ||
|
||
transition: | ||
border-color var(--vp-t-color), | ||
background var(--vp-t-color); | ||
|
||
@media print { | ||
border-color: var(--vp-c-text); | ||
} | ||
} | ||
|
||
&:checked { | ||
&::after { | ||
content: ''; | ||
border-color: var(--vp-c-accent-bg); | ||
background: var(--vp-c-accent-bg); | ||
|
||
@media print { | ||
border-color: var(--vp-c-text); | ||
background: transparent; | ||
} | ||
} | ||
|
||
&::before { | ||
content: ''; | ||
|
||
position: absolute; | ||
inset-inline-start: 0.35em; | ||
top: 0.1em; | ||
z-index: 1; | ||
|
||
width: 0.2em; | ||
height: 0.5em; | ||
border: solid var(--vp-c-white); | ||
border-width: 0 0.15em 0.15em 0; | ||
|
||
transition: border-color var(--vp-t-color); | ||
|
||
transform: rotate(45deg); | ||
|
||
@media print { | ||
border-color: var(--vp-c-text); | ||
} | ||
} | ||
} | ||
} |
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
14 changes: 14 additions & 0 deletions
14
plugins/markdown/plugin-markdown-ext/src/node/prepreClientConfigFile.ts
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,14 @@ | ||
import type { App } from 'vuepress' | ||
import { CLIENT_FOLDER } from './utils.js' | ||
|
||
export const prepareClientConfigFile = ( | ||
app: App, | ||
{ gfm, footnote, tasklist }: Record<string, unknown>, | ||
): Promise<string> => | ||
app.writeTemp( | ||
`markdown-ext/config.js`, | ||
`\ | ||
${(footnote ?? gfm) ? `import "${CLIENT_FOLDER}styles/footnote.css"\n` : ''}\ | ||
${(tasklist ?? gfm) ? `import "${CLIENT_FOLDER}styles/tasklist.css"\n` : ''}\ | ||
`, | ||
) |
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,5 +1,12 @@ | ||
import { Logger } from '@vuepress/helper' | ||
import { Logger, ensureEndingSlash } from '@vuepress/helper' | ||
import { getDirname, path } from 'vuepress/utils' | ||
|
||
const __dirname = getDirname(import.meta.url) | ||
|
||
export const PLUGIN_NAME = '@vuepress/plugin-markdown-ext' | ||
|
||
export const logger = new Logger(PLUGIN_NAME) | ||
|
||
export const CLIENT_FOLDER = ensureEndingSlash( | ||
path.resolve(__dirname, '../client'), | ||
) |