mirror of
				https://github.com/kuohuanhuan/x-markdown-css.git
				synced 2024-11-25 06:18:19 +00:00 
			
		
		
		
	Compare commits
	
		
			16 Commits
		
	
	
		
			v0.0.2
			...
			2e99e64a3e
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 2e99e64a3e | |||
| 877ea710d6 | |||
| df63212d6d | |||
| ee89b96068 | |||
| 63a6fc2072 | |||
| e54282e5f8 | |||
| 2b9619f2e2 | |||
| 2cb60cc6c4 | |||
| beedb0e803 | |||
| 77e57fe3ae | |||
| 5f45d99381 | |||
| 936615f48c | |||
| 06f383891e | |||
| e7b3d3eb8d | |||
| 7ffabe53bd | |||
| 95a1576179 | 
							
								
								
									
										6
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							| @ -4,6 +4,12 @@ on: | |||||||
|   push: |   push: | ||||||
|     branches: |     branches: | ||||||
|       - master |       - master | ||||||
|  |     paths: | ||||||
|  |       - src/**.scss | ||||||
|  |       - package.json | ||||||
|  |       - Gruntfile.coffee | ||||||
|  |       - .stylelintrc | ||||||
|  |       - .stylelintignore | ||||||
|   pull_request: |   pull_request: | ||||||
|     branches: |     branches: | ||||||
|       - master |       - master | ||||||
|  | |||||||
							
								
								
									
										6
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							| @ -8,8 +8,8 @@ on: | |||||||
| jobs: | jobs: | ||||||
|   # NPM Registry & GitHub Release |   # NPM Registry & GitHub Release | ||||||
|   release: |   release: | ||||||
|     # Use Ubuntu 22.04 LTS |     # Use Windows Server 2022 | ||||||
|     runs-on: ubuntu-22.04 |     runs-on: windows-2022 | ||||||
|     steps: |     steps: | ||||||
|       # Step I |       # Step I | ||||||
|       - name: Get Source Code |       - name: Get Source Code | ||||||
| @ -33,7 +33,7 @@ jobs: | |||||||
|         uses: TheDoctor0/zip-release@0.7.1 |         uses: TheDoctor0/zip-release@0.7.1 | ||||||
|         with: |         with: | ||||||
|           type: tar |           type: tar | ||||||
|           path: dist/* |           path: dist/ | ||||||
|           filename: build.tar.gz |           filename: build.tar.gz | ||||||
|       # Step VI |       # Step VI | ||||||
|       - name: Publish to NPM Registry |       - name: Publish to NPM Registry | ||||||
|  | |||||||
							
								
								
									
										32
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								README.md
									
									
									
									
									
								
							| @ -14,37 +14,9 @@ | |||||||
|  |  | ||||||
| According to [.browserslistrc](https://github.com/kuohuanhuan/x-markdown-css/blob/master/.browserslistrc), `x-markdown-css` supports **all browsers support CSS variables.** | According to [.browserslistrc](https://github.com/kuohuanhuan/x-markdown-css/blob/master/.browserslistrc), `x-markdown-css` supports **all browsers support CSS variables.** | ||||||
|  |  | ||||||
| ## Usage | ## Get Started | ||||||
|  |  | ||||||
| You can use `x-markdown-css` with: | Visit the [Wiki](https://github.com/kuohuanhuan/x-markdown-css/wiki) page for more information. | ||||||
|  |  | ||||||
| 1. A CDN service: |  | ||||||
|  |  | ||||||
| - UNPKG: `https://unpkg.com/x-markdown-css@latest/dist/bundle.min.css` |  | ||||||
| - jsDelivr: `https://fastly.jsdelivr.net/npm/x-markdown-css@latest/dist/bundle.min.css` |  | ||||||
| - CDNJS: *Coming soon. **Waiting for you to make `x-markdown-css` [popular enough](https://github.com/cdnjs/packages/blob/master/CONTRIBUTING.md#policy-rules-and-guidelines)**!* |  | ||||||
|  |  | ||||||
| > *ps. Note that `bundle.css` without `.min` stands for unminified version.* |  | ||||||
|  |  | ||||||
| 2. A CSS (with Node.js) / Sass / SCSS project: |  | ||||||
|  |  | ||||||
| First, install it with NPM ([PNPM](https://pnpm.io) or [Yarn](https://yarnpkg.com) also works): |  | ||||||
|  |  | ||||||
| ```sh |  | ||||||
| npm i x-markdown-css@latest |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| Then, add it to your `.css` / `.sass` / `.scss` file. |  | ||||||
|  |  | ||||||
| For example, in CSS / SCSS you do: |  | ||||||
|  |  | ||||||
| ```css |  | ||||||
| @import 'x-markdown-css'; |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| > *ps. Note that no path or file extention is required |  | ||||||
| > since the `style` and `sass` field in `package.json` is filled.   |  | ||||||
| > Just simply use `'x-markdown-css'` to import it.* |  | ||||||
|  |  | ||||||
| ## Built with | ## Built with | ||||||
|  |  | ||||||
|  | |||||||
							
								
								
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "x-markdown-css", |   "name": "x-markdown-css", | ||||||
|   "version": "0.0.2", |   "version": "0.0.5", | ||||||
|   "lockfileVersion": 3, |   "lockfileVersion": 3, | ||||||
|   "requires": true, |   "requires": true, | ||||||
|   "packages": { |   "packages": { | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "x-markdown-css", |   "name": "x-markdown-css", | ||||||
|   "version": "0.0.2", |   "version": "0.0.5", | ||||||
|   "description": "A simple and customizable markdown CSS stylesheet for everyone.", |   "description": "A simple and customizable markdown CSS stylesheet for everyone.", | ||||||
|   "keywords": [ |   "keywords": [ | ||||||
|     "markdown", |     "markdown", | ||||||
| @ -16,8 +16,9 @@ | |||||||
|     "article", |     "article", | ||||||
|     "documentation" |     "documentation" | ||||||
|   ], |   ], | ||||||
|   "sass": "src/index.scss", |   "main": "dist/bundle.min.css", | ||||||
|   "style": "dist/bundle.min.css", |   "style": "dist/bundle.min.css", | ||||||
|  |   "sass": "src/index.scss", | ||||||
|   "repository": { |   "repository": { | ||||||
|     "type": "git", |     "type": "git", | ||||||
|     "url": "git+https://github.com/kuohuanhuan/x-markdown-css.git" |     "url": "git+https://github.com/kuohuanhuan/x-markdown-css.git" | ||||||
|  | |||||||
							
								
								
									
										8
									
								
								src/_content.scss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/_content.scss
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | |||||||
|  | @use 'sass:meta'; | ||||||
|  |  | ||||||
|  | @use 'partials/container'; | ||||||
|  |  | ||||||
|  | .markdown-body { | ||||||
|  |   @include container.container; | ||||||
|  |   @include meta.load-css('partials/all'); | ||||||
|  | } | ||||||
| @ -1,4 +1,4 @@ | |||||||
| @use 'sass:meta' as *; | @use 'sass:meta'; | ||||||
| 
 | 
 | ||||||
| @use 'variables/constants'; | @use 'variables/constants'; | ||||||
| @use 'variables/colors'; | @use 'variables/colors'; | ||||||
| @ -7,20 +7,21 @@ | |||||||
| @use 'variables/modes/dark'; | @use 'variables/modes/dark'; | ||||||
| 
 | 
 | ||||||
| :root { | :root { | ||||||
|   @each $name, $val in module-variables('constants') { |   @each $name, $val in meta.module-variables('constants') { | ||||||
|     --xm-#{$name}: #{$val}; |     --xm-#{$name}: #{$val}; | ||||||
|   } |   } | ||||||
|   @each $name, $val in module-variables('colors') { |   @each $name, $val in meta.module-variables('colors') { | ||||||
|     --xm-c-#{$name}: #{$val}; |     --xm-c-#{$name}: #{$val}; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | 
 | ||||||
| .markdown-body { | .markdown-body { | ||||||
|   @each $name, $val in module-variables('light') { |   @each $name, $val in meta.module-variables('light') { | ||||||
|     --xm-c-#{$name}: #{$val}; |     --xm-c-#{$name}: #{$val}; | ||||||
|   } |   } | ||||||
| } | } | ||||||
| .dark .markdown-body { | .dark .markdown-body { | ||||||
|   @each $name, $val in module-variables('dark') { |   @each $name, $val in meta.module-variables('dark') { | ||||||
|     --xm-c-#{$name}: #{$val}; |     --xm-c-#{$name}: #{$val}; | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,4 +1,2 @@ | |||||||
| @use 'scss/vars' as *; | @use 'vars'; | ||||||
|  | @use 'content'; | ||||||
| @import 'scss/markdown'; |  | ||||||
| @import 'scss/prose'; |  | ||||||
|  | |||||||
							
								
								
									
										9
									
								
								src/partials/_all.scss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								src/partials/_all.scss
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | |||||||
|  | @use 'title'; | ||||||
|  | @use 'text'; | ||||||
|  | @use 'link'; | ||||||
|  | @use 'code'; | ||||||
|  | @use 'quote'; | ||||||
|  | @use 'figure'; | ||||||
|  | @use 'list'; | ||||||
|  | @use 'table'; | ||||||
|  | @use 'media'; | ||||||
| @ -2,5 +2,9 @@ | |||||||
|   max-width: fit-content; |   max-width: fit-content; | ||||||
|   color: var(--xm-c-regular); |   color: var(--xm-c-regular); | ||||||
|   font-size: 1rem; |   font-size: 1rem; | ||||||
|  |   font-family: var(--xm-font-display) !important; | ||||||
|   line-height: 1.75; |   line-height: 1.75; | ||||||
|  |   &:first-child { | ||||||
|  |     margin-top: 1rem; | ||||||
|  |   } | ||||||
| } | } | ||||||
| @ -33,3 +33,9 @@ pre { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | .shiki { | ||||||
|  |   margin: .5rem 0; | ||||||
|  |   font-size: 1.05rem; | ||||||
|  |   font-family: var(--xm-font-code) !important; | ||||||
|  |   line-height: 1.4; | ||||||
|  | } | ||||||
							
								
								
									
										13
									
								
								src/partials/link.scss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								src/partials/link.scss
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | |||||||
|  | a { | ||||||
|  |   border-bottom: 1px solid var(--xm-c-a-border); | ||||||
|  |   color: var(--xm-c-deeper); | ||||||
|  |   font-weight: 500; | ||||||
|  |   text-decoration: none; | ||||||
|  |   transition: border .3s ease-in-out; | ||||||
|  |   code { | ||||||
|  |     color: var(--xm-c-code); | ||||||
|  |   } | ||||||
|  |   &:hover { | ||||||
|  |     border-bottom: 1px solid var(--xm-c-regular); | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -1,5 +1,6 @@ | |||||||
| img, | img, | ||||||
| video { | video { | ||||||
|  |   width: 100%; | ||||||
|   margin-top: 2rem; |   margin-top: 2rem; | ||||||
|   margin-bottom: 2rem; |   margin-bottom: 2rem; | ||||||
| } | } | ||||||
| @ -2,12 +2,14 @@ blockquote, | |||||||
| q { | q { | ||||||
|   margin-top: 1.65rem; |   margin-top: 1.65rem; | ||||||
|   margin-bottom: 1.65rem; |   margin-bottom: 1.65rem; | ||||||
|   padding-left: 1rem; |   padding: .6rem 1.2rem; | ||||||
|   border-left: .25rem solid var(--xm-c-quote-border); |   border-left: .25rem solid var(--xm-c-quote-border); | ||||||
|   color: inherit; |   color: inherit; | ||||||
|   font-weight: 500; |   font-weight: 500; | ||||||
|   font-style: italic; |   font-style: italic; | ||||||
|  |   line-height: 1.5rem; | ||||||
|   quotes: '\201C''\201D''\2018''\2019'; |   quotes: '\201C''\201D''\2018''\2019'; | ||||||
|  |   opacity: .8; | ||||||
|   p { |   p { | ||||||
|     &:first-of-type::before { |     &:first-of-type::before { | ||||||
|       content: open-quote; |       content: open-quote; | ||||||
| @ -16,4 +18,12 @@ q { | |||||||
|       content: close-quote; |       content: close-quote; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |   > * { | ||||||
|  |     &:first-child { | ||||||
|  |       margin-top: 0; | ||||||
|  |     } | ||||||
|  |     &:last-child { | ||||||
|  |       margin-bottom: 0; | ||||||
|  |     } | ||||||
|  |   } | ||||||
| } | } | ||||||
| @ -55,10 +55,35 @@ h6 { | |||||||
|   opacity: .5; |   opacity: .5; | ||||||
| } | } | ||||||
| hr { | hr { | ||||||
|   margin-top: 3rem; |   width: 50px; | ||||||
|   margin-bottom: 3rem; |   margin-top: 2rem; | ||||||
|  |   margin-bottom: 2rem; | ||||||
|   border-color: var(--xm-c-hr-border); |   border-color: var(--xm-c-hr-border); | ||||||
|   + * { |   + * { | ||||||
|     margin-top: 0; |     margin-top: 0; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | .header-anchor { | ||||||
|  |   float: left; | ||||||
|  |   margin-top: .125rem; | ||||||
|  |   margin-left: -1.25rem; | ||||||
|  |   padding-right: .5rem; | ||||||
|  |   border: 0 !important; | ||||||
|  |   font-size: .875rem; | ||||||
|  |   text-decoration: none; | ||||||
|  |   opacity: 0; | ||||||
|  |   &:hover, | ||||||
|  |   &:focus { | ||||||
|  |     text-decoration: none; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | @for $i from 1 through 6 { | ||||||
|  |   h#{$i} { | ||||||
|  |     &:hover, | ||||||
|  |     &:focus { | ||||||
|  |       .header-anchor { | ||||||
|  |         opacity: .35 + $i * .025; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -1,103 +0,0 @@ | |||||||
| .markdown-body { |  | ||||||
|   color: var(--xm-c-regular); |  | ||||||
|   font-family: var(--xm-font-display) !important; |  | ||||||
|   pre:not(.shiki, .highlight) { |  | ||||||
|     margin: 0; |  | ||||||
|     padding: 0; |  | ||||||
|     background: transparent; |  | ||||||
|   } |  | ||||||
|   .shiki, |  | ||||||
|   .highlight { |  | ||||||
|     margin: .5rem 0; |  | ||||||
|     font-size: 1.05rem; |  | ||||||
|     font-family: var(--xm-font-code) !important; |  | ||||||
|     line-height: 1.4; |  | ||||||
|     &.shiki-light { |  | ||||||
|       background: var(--xm-c-shiki-light) !important; |  | ||||||
|     } |  | ||||||
|     &.shiki-dark { |  | ||||||
|       background: var(--xm-c-shiki-dark) !important; |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|   img { |  | ||||||
|     width: 100%; |  | ||||||
|   } |  | ||||||
|   a { |  | ||||||
|     border-bottom: 1px solid var(--xm-c-link-border); |  | ||||||
|     font-weight: inherit; |  | ||||||
|     text-decoration: none; |  | ||||||
|     transition: border .3s ease-in-out; |  | ||||||
|     &:hover { |  | ||||||
|       border-bottom: 1px solid var(--xm-c-regular); |  | ||||||
|     } |  | ||||||
|     code { |  | ||||||
|       color: inherit; |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|   hr { |  | ||||||
|     width: 50px; |  | ||||||
|     margin-top: 2rem; |  | ||||||
|     margin-bottom: 2rem; |  | ||||||
|   } |  | ||||||
|   blockquote, |  | ||||||
|   q { |  | ||||||
|     padding: .6rem 1.2rem; |  | ||||||
|     font-weight: normal; |  | ||||||
|     font-style: normal; |  | ||||||
|     line-height: 1.5rem; |  | ||||||
|     opacity: .8; |  | ||||||
|     > * { |  | ||||||
|       &:first-child { |  | ||||||
|         margin-top: 0; |  | ||||||
|       } |  | ||||||
|       &:last-child { |  | ||||||
|         margin-bottom: 0; |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|     p:first-of-type { |  | ||||||
|       &::before, |  | ||||||
|       &::after { |  | ||||||
|         content: none; |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|   &:first-child { |  | ||||||
|     margin-top: 1rem; |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| html:not(.dark) .shiki-dark, |  | ||||||
| .dark .shiki-light { |  | ||||||
|   display: none; |  | ||||||
| } |  | ||||||
| .item { |  | ||||||
|   text-decoration: none; |  | ||||||
|   opacity: .6; |  | ||||||
|   transition: .2s all ease-out; |  | ||||||
|   &:hover { |  | ||||||
|     opacity: 1; |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| .header-anchor { |  | ||||||
|   float: left; |  | ||||||
|   margin-top: .125rem; |  | ||||||
|   margin-left: -1.25rem; |  | ||||||
|   padding-right: .5rem; |  | ||||||
|   border: 0 !important; |  | ||||||
|   font-size: .875rem; |  | ||||||
|   text-decoration: none; |  | ||||||
|   opacity: 0; |  | ||||||
|   &:hover, |  | ||||||
|   &:focus { |  | ||||||
|     text-decoration: none; |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| @for $i from 1 through 6 { |  | ||||||
|   h#{$i} { |  | ||||||
|     &:hover, |  | ||||||
|     &:focus { |  | ||||||
|       .header-anchor { |  | ||||||
|         opacity: .35 + $i * .025; |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| @ -1 +0,0 @@ | |||||||
| @import 'title', 'text', 'link', 'code', 'quote', 'figure', 'list', 'table', 'media'; |  | ||||||
| @ -1,8 +0,0 @@ | |||||||
| a { |  | ||||||
|   color: var(--xm-c-deeper); |  | ||||||
|   font-weight: 500; |  | ||||||
|   text-decoration: none; |  | ||||||
|   code { |  | ||||||
|     color: var(--xm-c-code); |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| @ -1,6 +0,0 @@ | |||||||
| @use 'partials/container' as *; |  | ||||||
|  |  | ||||||
| .prose { |  | ||||||
|   @include container; |  | ||||||
|   @import 'partials/all'; |  | ||||||
| } |  | ||||||
| @ -7,12 +7,8 @@ $ol-counter: #6b7280; | |||||||
| $ul-counter: #d1d5db; | $ul-counter: #d1d5db; | ||||||
| 
 | 
 | ||||||
| // Border | // Border | ||||||
| $link-border: hsla(0deg 0% 50% / .3); | $a-border: hsla(0deg 0% 50% / .3); | ||||||
| $hr-border: hsla(0deg 0% 50% / .3); | $hr-border: hsla(0deg 0% 50% / .3); | ||||||
| $quote-border: hsla(0deg 0% 50% / .3); | $quote-border: hsla(0deg 0% 50% / .3); | ||||||
| $thead-border: #d1d5db; | $thead-border: #d1d5db; | ||||||
| $tr-border: #e5e7eb; | $tr-border: #e5e7eb; | ||||||
| 
 |  | ||||||
| // Shiki (code highlight) |  | ||||||
| $shiki-light: #f8f8f8; |  | ||||||
| $shiki-dark: #0e0e0e; |  | ||||||
| @ -1,7 +1,7 @@ | |||||||
| // Font stack | // Font stack | ||||||
| $font-sans: 'Open Sans', 'Inter', 'Roboto', 'Helvetica', 'Arial', 'Sarasa Gothic TC', 'Sarasa Gothic SC', 'Noto Sans TC', 'Noto Sans SC', 'Microsoft JhengHei', 'Microsoft YaHei', -apple-system, sans-serif; | $font-sans: 'Open Sans', 'Inter', 'Roboto', 'Helvetica', 'Arial', 'Sarasa Gothic TC', 'Sarasa Gothic SC', 'Noto Sans TC', 'Noto Sans SC', 'Microsoft JhengHei', 'Microsoft YaHei', -apple-system, sans-serif; | ||||||
| $font-serif: 'Merriweather', 'Georgia', 'Times New Roman', 'Times', 'Source Han Serif Traditional Chinese', 'Source Han Serif Simplified Chinese', 'Noto Serif TC', 'Noto Serif SC', serif; | $font-serif: 'Merriweather', 'Georgia', 'Times New Roman', 'Times', 'Source Han Serif Traditional Chinese', 'Source Han Serif Simplified Chinese', 'Noto Serif TC', 'Noto Serif SC', serif; | ||||||
| $font-mono: 'DM Mono', 'Fira Code', 'Jetbrains Mono', 'Input Mono', 'Menlo', 'MesloLGS NF', 'Ubuntu', monospace; | $font-mono: 'DM Mono', 'Fira Code', 'Jetbrains Mono', 'Input Mono', 'Menlo', 'MesloLGS NF', 'Ubuntu', 'Sarasa Gothic TC', 'Sarasa Gothic SC', monospace; | ||||||
| 
 | 
 | ||||||
| // Font defaults | // Font defaults | ||||||
| $font-display: var(--xm-font-sans); | $font-display: var(--xm-font-sans); | ||||||
		Reference in New Issue
	
	Block a user