Compare commits

..

No commits in common. "master" and "Latest" have entirely different histories.

36 changed files with 1037 additions and 1475 deletions

View File

@ -1,5 +1,3 @@
# EditorConfig <http://editorconfig.org>
root = true
[*]

View File

@ -4,12 +4,6 @@ on:
push:
branches:
- master
paths:
- src/**.scss
- package.json
- Gruntfile.coffee
- .stylelintrc
- .stylelintignore
pull_request:
branches:
- master
@ -17,7 +11,7 @@ on:
jobs:
# Test Lint
lint:
# Use Ubuntu 22.04 LTS
# Use Ubuntu 22.04
runs-on: ubuntu-22.04
steps:
# Step I
@ -27,7 +21,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
node-version: 18
registry-url: https://registry.npmjs.com
# Step III
- name: Install Dependencies

View File

@ -1,15 +1,15 @@
name: Release
name: Build and Release
on:
push:
tags:
- v*
- 'v*'
jobs:
# NPM Registry & GitHub Release
release:
# Use Windows Server 2022
runs-on: windows-2022
# Use Ubuntu 22.04
runs-on: ubuntu-22.04
steps:
# Step I
- name: Get Source Code
@ -20,7 +20,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
node-version: 18
registry-url: https://registry.npmjs.com
# Step III
- name: Install Dependencies
@ -46,23 +46,28 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Step VIII
# / pre-release
- name: GitHub Release (pre-release)
# - Pre-release
- name: GitHub Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-')
uses: softprops/action-gh-release@v1
with:
prerelease: true
files: |
dist/*
build.tar.gz
# / release
- name: GitHub Release (release)
build.zip
# - Release
- name: GitHub Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-') == false
uses: softprops/action-gh-release@v1
with:
prerelease: false
files: |
dist/*
build.tar.gz
build.zip
- name: Add Latest Tag
uses: cardinalby/git-tag-action@master
env:
TAG: Latest
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Authored by @kuohuanhuan.

View File

@ -1,4 +1,21 @@
{
"ignoreDisables": true,
"extends": "@kuohuanhuan/stylelint-config"
"extends": [
"stylelint-config-standard-scss",
"stylelint-config-hudochenkov/order"
],
"plugins": ["stylelint-scss"],
"rules": {
"alpha-value-notation": "number",
"at-rule-empty-line-before": null,
"block-no-empty": true,
"color-named": "never",
"color-hex-case": "lower",
"import-notation": null,
"max-nesting-depth": 5,
"no-invalid-position-at-import-rule": null,
"number-leading-zero": "never",
"property-no-vendor-prefix": true,
"rule-empty-line-before": null
}
}

View File

@ -1,6 +1,7 @@
module.exports = (grunt) ->
# Load Grunt Tasks
require('load-grunt-tasks') grunt
# Project Configuration
grunt.initConfig
# NPM Package Declare

View File

@ -1,52 +1,26 @@
<h1 align="center">x-markdown-css</h1>
> [!IMPORTANT]
> I am working on a new CSS styling library, so `x-markdown-css` is deprecated.
> PS. Sass dev team supports Palestine Hamas. **I am dropping it.**
<center>
[![NPM Version](https://img.shields.io/npm/v/x-markdown-css)](https://www.npmjs.com/package/x-markdown-css)
[![GitHub Actions](https://img.shields.io/github/actions/workflow/status/kuohuanhuan/x-markdown-css/ci.yml)](https://github.com/kuohuanhuan/x-markdown-css/actions/workflows/ci.yml)
[![MIT License](https://img.shields.io/github/license/kuohuanhuan/x-markdown-css?color=blue)](https://github.com/kuohuanhuan/x-markdown-css/blob/master/LICENSE)
[![Version](https://img.shields.io/npm/v/x-markdown-css.svg)](https://www.npmjs.com/package/x-markdown-css)
[![Node.js Requirement](https://img.shields.io/badge/node-%3E%3D16-blue.svg)](https://github.com/kuohuanhuan/x-markdown-css/blob/master/package.json)
[![MIT License](https://img.shields.io/github/license/kuohuanhuan/x-markdown-css)](https://github.com/kuohuanhuan/x-markdown-css/blob/master/LICENSE)
</center>
> A simple and customizable markdown CSS stylesheet for everyone.
## Browsers Support
According to [.browserslistrc](https://github.com/kuohuanhuan/x-markdown-css/blob/master/.browserslistrc), `x-markdown-css` supports **all browsers support CSS variables.**
## Get Started
Visit the [Wiki](https://github.com/kuohuanhuan/x-markdown-css/wiki) page for more information.
## Built with
The following tools and suite libraries made the development of `x-markdown-css` possible:
- [SCSS](https://sass-lang.com)
- [Stylelint](https://stylelint.io)
- [Grunt](https://gruntjs.com)
- [PostCSS](https://postcss.org)
- [cssnano](https://cssnano.co)
*...and much more.*
## Development
### Requirement
## Requirement
- Node.js >= 16
### Install
## Install
```sh
npm i
```
### Build
## Build
```sh
npm run build
@ -64,6 +38,26 @@ or
npx grunt build
```
## Usage
You can use the minified CSS file with 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. `bundle.css` without `.min` stands for unminified version.*
## Uses
- [SCSS](https://sass-lang.com)
- [Stylelint](https://stylelint.io)
- [Grunt](https://gruntjs.com)
- [PostCSS](https://postcss.org)
- [cssnano](https://cssnano.co)
*...and much more.*
## Contributing
PRs, issues and feature requests are welcome!

1941
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "x-markdown-css",
"version": "0.1.6",
"version": "0.0.0-20230303.5",
"description": "A simple and customizable markdown CSS stylesheet for everyone.",
"keywords": [
"markdown",
@ -16,18 +16,13 @@
"article",
"documentation"
],
"main": "dist/bundle.min.css",
"style": "dist/bundle.min.css",
"sass": "src/index.scss",
"style": "dist/bundle.min.css",
"repository": {
"type": "git",
"url": "git+https://github.com/kuohuanhuan/x-markdown-css.git"
},
"author": {
"name": "kuohuanhuan",
"email": "hi@nekohuan.cyou",
"url": "https://nekohuan.cyou"
},
"author": "kuohuanhuan",
"license": "MIT",
"bugs": {
"url": "https://github.com/kuohuanhuan/x-markdown-css/issues"
@ -47,16 +42,18 @@
"sass": "^1.58.3"
},
"devDependencies": {
"@kuohuanhuan/stylelint-config": "^0.0.5",
"@lodder/grunt-postcss": "^3.1.1",
"autoprefixer": "^10.4.13",
"bumpp": "^9.0.0",
"cssnano": "^6.0.0",
"cssnano": "^5.1.15",
"grunt": "^1.6.1",
"grunt-sass": "^3.1.0",
"load-grunt-tasks": "^5.1.0",
"postcss": "^8.4.21",
"postcss-preset-env": "^8.0.1",
"stylelint": "^15.2.0"
"stylelint": "^15.2.0",
"stylelint-config-hudochenkov": "^9.0.0",
"stylelint-config-standard-scss": "^7.0.1",
"stylelint-scss": "^4.4.0"
}
}

View File

@ -1,7 +0,0 @@
@use 'sass:meta';
@use 'partials/container';
.markdown-body {
@include container.container;
@include meta.load-css('partials/all');
}

View File

@ -1,22 +0,0 @@
@use 'sass:meta';
@use 'variables/constants';
@use 'variables/modes/light';
@use 'variables/modes/dark';
:root {
@each $name, $val in meta.module-variables('constants') {
--xm-#{$name}: #{$val};
}
}
.markdown-body {
@each $name, $val in meta.module-variables('light') {
--xm-c-#{$name}: #{$val};
}
}
.dark .markdown-body {
@each $name, $val in meta.module-variables('dark') {
--xm-c-#{$name}: #{$val};
}
}

View File

@ -1,2 +1,4 @@
@use 'vars';
@use 'content';
@use 'scss/vars' as *;
@import 'scss/markdown';
@import 'scss/prose';

View File

@ -1,9 +0,0 @@
@forward 'title';
@forward 'text';
@forward 'link';
@forward 'code';
@forward 'quote';
@forward 'figure';
@forward 'list';
@forward 'table';
@forward 'media';

View File

@ -1,10 +0,0 @@
@mixin container {
max-width: fit-content;
color: var(--xm-c-regular);
font-size: 1rem;
font-family: var(--xm-font-display) !important;
line-height: 1.75;
&:first-child {
margin-top: 1rem;
}
}

View File

@ -1,19 +0,0 @@
a {
border-bottom: 1px solid var(--xm-c-border);
color: var(--xm-c-deeper);
font-weight: 500;
text-decoration: none;
transition: border .3s ease-in-out;
code {
color: var(--xm-c-deep);
}
&:hover {
border-bottom: 1px solid var(--xm-c-regular);
}
&:not([href]) {
border-bottom: none;
color: inherit;
font-weight: normal;
transition: none;
}
}

View File

@ -1,17 +0,0 @@
img {
display: block;
max-width: 92%;
margin: 1rem auto;
border-radius: .2rem;
}
video {
margin: auto;
}
iframe {
display: flex;
width: 92%;
margin: auto;
border-radius: .2rem;
}

View File

@ -1,19 +0,0 @@
table {
overflow: auto;
width: 100%;
border-spacing: 0;
border-collapse: collapse;
th,
td {
padding: 6px 13px;
border: 1.5px solid var(--xm-c-border-table);
}
thead th {
font-weight: 700;
}
tbody tr {
&:hover {
background-color: var(--xm-c-shallowest);
}
}
}

103
src/scss/markdown.scss Normal file
View File

@ -0,0 +1,103 @@
.markdown-body {
color: var(--xm-c-general);
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-mono) !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-general);
}
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;
}
}
}
}

View File

@ -0,0 +1 @@
@import 'title', 'text', 'link', 'code', 'quote', 'figure', 'list', 'table', 'media';

View File

@ -0,0 +1,6 @@
@mixin container {
max-width: fit-content;
color: var(--xm-c-general);
font-size: 1rem;
line-height: 1.75;
}

View File

@ -1,21 +1,20 @@
code {
color: var(--xm-c-deep);
color: var(--xm-c-dark);
font-weight: 600;
font-size: .875rem;
font-family: var(--xm-font-code);
font-family: var(--xm-font-mono);
&::before,
&::after {
content: '`';
}
}
pre {
overflow-x: auto;
margin-top: 1.75rem;
margin-bottom: 1.75rem;
padding-top: .875rem, 1.15rem;
border-radius: .375rem;
color: var(--xm-c-deep);
color: var(--xm-c-pre);
font-size: .875rem;
line-height: 1.75;
code {
@ -33,10 +32,4 @@ pre {
content: none;
}
}
&:has(code) {
margin: .5rem 0;
font-size: 1.05rem;
font-family: var(--xm-font-code);
line-height: 1.4;
}
}

View File

@ -3,7 +3,7 @@ figure {
margin-bottom: 2rem;
figcaption {
margin-top: .875rem;
color: var(--xm-c-shallow);
color: var(--xm-c-figcaption);
font-size: .875rem;
line-height: 1.45;
}

View File

@ -0,0 +1,8 @@
a {
color: var(--xm-c-darker);
font-weight: 500;
text-decoration: none;
code {
color: var(--xm-c-code);
}
}

View File

@ -2,7 +2,6 @@ li {
margin-top: .5rem;
margin-bottom: .5rem;
}
ol {
margin-top: 1.25rem;
margin-bottom: 1.25rem;
@ -14,12 +13,11 @@ ol {
content: counter(list-item, decimal) '.';
position: absolute;
left: 0;
color: var(--xm-c-shallow);
color: var(--xm-c-ol-counter);
font-weight: 400;
}
}
}
ul {
margin-top: 1.25rem;
margin-bottom: 1.25rem;
@ -35,11 +33,10 @@ ul {
width: .375rem;
height: .375rem;
border-radius: 50%;
background-color: var(--xm-c-shallower);
background-color: var(--xm-c-ul-counter);
}
}
}
ul ul,
ul ol,
ol ul,

View File

@ -0,0 +1,5 @@
img,
video {
margin-top: 2rem;
margin-bottom: 2rem;
}

View File

@ -2,14 +2,12 @@ blockquote,
q {
margin-top: 1.65rem;
margin-bottom: 1.65rem;
padding: .6rem 1.2rem;
border-left: .25rem solid var(--xm-c-border);
padding-left: 1rem;
border-left: .25rem solid var(--xm-c-quote-border);
color: inherit;
font-weight: 500;
font-style: italic;
line-height: 1.5rem;
quotes: '\201C''\201D''\2018''\2019';
opacity: .75;
p {
&:first-of-type::before {
content: open-quote;
@ -18,12 +16,4 @@ q {
content: close-quote;
}
}
> * {
&:first-child {
margin-top: 0;
}
&:last-child {
margin-bottom: 0;
}
}
}

View File

@ -0,0 +1,44 @@
table {
width: 100%;
margin-top: 2rem;
margin-bottom: 2rem;
table-layout: auto;
font-size: .875rem;
line-height: 1.75;
text-align: left;
}
thead {
border-bottom-width: 1px;
border-bottom-color: var(--xm-c-thead-border);
color: var(--xm-c-thead);
font-weight: 600;
th {
vertical-align: bottom;
padding-left: auto .575rem .575rem;
&:first-child {
padding-left: 0;
}
&:last-child {
padding-right: 0;
}
}
}
tbody {
tr {
border-bottom-width: 1px;
border-bottom-color: var(--xm-c-tr-border);
&:last-child {
border-bottom-width: 0;
}
}
td {
vertical-align: top;
padding: .575rem;
&:first-child {
padding-left: 0;
}
&:last-child {
padding-right: 0;
}
}
}

View File

@ -2,16 +2,13 @@ p {
margin-top: 1.25rem;
margin-bottom: 1.25rem;
}
strong {
color: var(--xm-c-deep);
color: var(--xm-c-dark);
font-weight: 600;
}
b {
color: var(--xm-c-deep);
color: var(--xm-c-dark);
}
em {
color: inherit;
}

View File

@ -1,16 +1,15 @@
h1 {
margin-top: 0;
margin-bottom: .875rem;
color: var(--xm-c-deeper);
color: var(--xm-c-darker);
font-weight: 800;
font-size: 2.25rem;
line-height: 1.15;
}
h2 {
margin-top: 2rem;
margin-bottom: 1rem;
color: var(--xm-c-deep);
color: var(--xm-c-dark);
font-weight: 700;
font-size: 1.5rem;
line-height: 1.35;
@ -21,7 +20,6 @@ h2 {
margin-top: 0;
}
}
h3 {
margin-top: 1.6rem;
margin-bottom: .6rem;
@ -37,7 +35,6 @@ h3 {
margin-top: 0;
}
}
h4 {
margin-top: 1.5rem;
margin-bottom: .5rem;
@ -48,7 +45,6 @@ h4 {
margin-top: 0;
}
}
h5,
h6 {
margin-top: 20px;
@ -58,40 +54,11 @@ h6 {
text-transform: uppercase;
opacity: .5;
}
hr {
width: 50px;
margin-top: 2rem;
margin-bottom: 2rem;
margin-top: 3rem;
margin-bottom: 3rem;
border-color: var(--xm-c-hr-border);
+ * {
margin-top: 0;
}
}
.header-anchor {
float: left;
margin-top: 0;
margin-left: -1.25rem;
padding-right: .5rem;
border: 0 !important;
font-weight: 600;
font-size: inherit;
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;
}
}
}
}

6
src/scss/prose.scss Normal file
View File

@ -0,0 +1,6 @@
@use 'partials/container' as *;
.prose {
@include container;
@import 'partials/all';
}

View File

@ -0,0 +1,13 @@
$shiki-light: #f8f8f8;
$shiki-dark: #0e0e0e;
$link-border: hsla(0deg 0 50% / .3);
$code: #111827;
$ol-counter: #6b7280;
$ul-counter: #d1d5db;
$hr-border: hsla(0deg 0 50% / .3);
$quote-border: hsla(0deg 0 50% / .3);
$figcaption: #6b7280;
$pre: #e5e7eb;
$thead: #111827;
$thead-border: #d1d5db;
$tr-border: #e5e7eb;

View File

@ -1,8 +1,5 @@
// 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-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', 'Sarasa Gothic TC', 'Sarasa Gothic SC', monospace;
$font-mono: 'DM Mono', 'Fira Code', 'Jetbrains Mono', 'Input Mono', 'Menlo', 'MesloLGS NF', 'Ubuntu', monospace;
// Font defaults
$font-display: var(--xm-font-sans);
$font-code: var(--xm-font-mono);

View File

@ -0,0 +1,3 @@
$general: #bbb;
$dark: #ddd;
$darker: #fff;

View File

@ -0,0 +1,3 @@
$general: #555;
$dark: #222;
$darker: #000;

25
src/scss/vars.scss Normal file
View File

@ -0,0 +1,25 @@
@use 'sass:meta' as *;
@use 'variables/constants';
@use 'variables/colors';
@use 'variables/light';
@use 'variables/dark';
:root {
@each $name, $val in module-variables('constants') {
--xm-#{$name}: #{$val};
}
@each $name, $val in module-variables('colors') {
--xm-c-#{$name}: #{$val};
}
}
.markdown-body {
@each $name, $val in module-variables('light') {
--xm-c-#{$name}: #{$val};
}
}
.dark .markdown-body {
@each $name, $val in module-variables('dark') {
--xm-c-#{$name}: #{$val};
}
}

View File

@ -1,10 +0,0 @@
// Dark mode
$shallowest: #212121;
$shallower: #555;
$shallow: #777;
$regular: #bbb;
$deep: #ddd;
$deeper: #fff;
$border: hsla(0deg 0% 75% / .35);
$border-table: hsla(0deg 0% 40% / .75);

View File

@ -1,10 +0,0 @@
// Light mode
$shallowest: #f8f8f8;
$shallower: #ddd;
$shallow: #bbb;
$regular: #555;
$deep: #222;
$deeper: #000;
$border: hsla(0deg 0% 50% / .35);
$border-table: hsla(0deg 0% 50% / .5);