diff --git a/.gitignore b/.gitignore index 38ac529..8976752 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ .settings/ # Dev dependencies and cache files -dist/ node_modules/ npm-debug.log diff --git a/README.md b/README.md index 3101566..2d7e1d9 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ 1. 在页面的 `` 标签中引入 `heti.css` 文件: ``` - + ``` 1. 在要作用的容器元素上增加 `class="heti"` 的类名即可:。 ``` diff --git a/demo/favicon.png b/demo/favicon.png new file mode 100644 index 0000000..d0977d9 Binary files /dev/null and b/demo/favicon.png differ diff --git a/demo/favicon.svg b/demo/favicon.svg new file mode 100644 index 0000000..0e4a719 --- /dev/null +++ b/demo/favicon.svg @@ -0,0 +1,16 @@ + + + + diff --git a/demo/heti.min.css b/demo/heti.min.css new file mode 100644 index 0000000..6d52fd4 --- /dev/null +++ b/demo/heti.min.css @@ -0,0 +1,5 @@ +/*! + * Project: Heti + * URL: https://github.com/sivan/heti + * Author: Sivan [sun.sivan@gmail.com] + */@font-face{font-family:"Heti Hei";src:local("PingFang SC Regular"),local("PingFang TC Regular"),local("Hiragino Sans GB W3"),local("Heiti SC Regular"),local("Heiti TC Regular"),local("Microsoft YaHei"),local("Microsoft Jhenghei"),local("Source Han Sans CN Regular"),local("Source Han Sans HK Regular"),local("Source Han Sans TW Regular"),local("Source Han Sans JP Regular"),local("Source Han Sans KR Regular"),local("Noto Sans CJK SC Regular"),local("Noto Sans CJK TC Regular"),local("Noto Sans CJK JP Regular"),local("Noto Sans CJK KR Regular"),local("WenQuanYi Micro Hei"),local("Droid Sans Fallback")}@font-face{font-family:"Heti Hei";font-weight:200;src:local("PingFang SC Light"),local("PingFang TC Light"),local("Heiti SC Light"),local("Heiti TC Light"),local("Microsoft YaHei Light"),local("Microsoft Jhenghei Light"),local("Source Han Sans CN Light"),local("Source Han Sans HK Light"),local("Source Han Sans TW Light"),local("Source Han Sans JP Light"),local("Source Han Sans KR Light"),local("Noto Sans CJK SC Light"),local("Noto Sans CJK TC Light"),local("Noto Sans CJK JP Light"),local("Noto Sans CJK KR Light")}@font-face{font-family:"Heti Hei";font-weight:600;src:local("PingFang SC Medium"),local("Hiragino Sans GB W6"),local("PingFang TC Medium"),local("Heiti SC Medium"),local("Heiti TC Medium"),local("Microsoft YaHei Bold"),local("Microsoft Jhenghei Bold"),local("Source Han Sans CN Bold"),local("Source Han Sans HK Bold"),local("Source Han Sans TW Bold"),local("Source Han Sans JP Bold"),local("Source Han Sans KR Bold"),local("Noto Sans CJK SC Bold"),local("Noto Sans CJK TC Bold"),local("Noto Sans CJK JP Bold"),local("Noto Sans CJK KR Bold")}@font-face{font-family:"Heti Hei Black";font-weight:800;src:local("Lantinghei SC Heavy"),local("Lantinghei TC Heavy"),local("PingFang SC Semibold"),local("PingFang TC Semibold"),local("Hiragino Sans GB W6"),local("Heiti SC Medium"),local("Heiti TC Medium"),local("Microsoft YaHei Bold"),local("Microsoft Jhenghei Bold"),local("Source Han Sans CN Heavy"),local("Source Han Sans HK Heavy"),local("Source Han Sans TW Heavy"),local("Source Han Sans JP Heavy"),local("Source Han Sans KR Heavy"),local("Noto Sans CJK SC Heavy"),local("Noto Sans CJK TC Heavy"),local("Noto Sans CJK JP Heavy"),local("Noto Sans CJK KR Heavy"),local("Droid Sans Fallback")}@font-face{font-family:"Heti Song";src:local("Songti SC Regular"),local("Songti TC Regular"),local("SimSun")}@font-face{font-family:"Heti Song";font-weight:200;src:local("Songti SC Light"),local("Songti TC Light"),local(STSong),local("SimSun")}@font-face{font-family:"Heti Song";font-weight:600;src:local("Songti SC Bold"),local("Songti TC Bold"),local("SimSun")}@font-face{font-family:"Heti Song Black";font-weight:800;src:local("Songti SC Black"),local("SimSun")}@font-face{font-family:"Heti Kai";src:local("Kaiti SC Regular"),local("Kaiti TC Regular"),local("BiauKai")}@font-face{font-family:"Heti Kai";font-weight:600;src:local("Kaiti SC Bold"),local("Kaiti TC Bold")}@font-face{font-family:"Heti Kai Black";font-weight:800;src:local("Kaiti SC Black"),local("Kaiti TC Black")}.heti{max-width:42em;font-size:16px;font-weight:400;line-height:1.5}.heti::before,.heti::after{content:"";display:table}.heti::after{clear:both}.heti>*:first-child,.heti section>*:first-child,.heti td>*:first-child{margin-block-start:0 !important}.heti>*:last-child,.heti section>*:last-child,.heti td>*:last-child{margin-block-end:0 !important}.heti blockquote{margin-block-start:12px;margin-block-end:24px;margin-inline-start:32px;margin-inline-end:32px;padding-block-start:12px;padding-block-end:12px;padding-inline-start:16px;padding-inline-end:16px;background-color:rgba(0,0,0,0.054)}.heti figure{display:block;text-align:center}.heti figure>img{display:block;margin-inline-start:auto;margin-inline-end:auto}.heti hr{width:30%;height:1px;margin-block-start:48px;margin-block-end:47px;margin-inline-start:auto;margin-inline-end:auto;border:0;background-color:#ddd}.heti p{margin-block-start:12px;margin-block-end:24px;text-align:justify}.heti p:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti p:not(:lang(zh)){text-align:start}.heti pre{margin-block-start:12px;margin-block-end:12px;margin-inline-start:0;margin-inline-end:0;padding-block-start:12px;padding-block-end:12px;padding-inline-start:16px;padding-inline-end:16px;overflow:auto;font-family:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";white-space:pre;word-wrap:normal;background-color:rgba(0,0,0,0.054);border-radius:4px}.heti pre code{margin:0;padding:0;border:0;border-radius:0;background-color:transparent;color:inherit}.heti h1,.heti h2,.heti h3,.heti h4,.heti h5,.heti h6{position:relative;margin:0;margin-block-start:24px;margin-block-end:12px;font-weight:600}.heti h1{margin-block-end:24px;font-size:32px;line-height:48px;letter-spacing:1.6px}.heti h2{font-size:24px;line-height:36px;letter-spacing:1.2px}.heti h3{font-size:20px;line-height:36px;letter-spacing:1px}.heti h4{font-size:18px;line-height:24px}.heti h5{font-size:16px;line-height:24px}.heti h6{font-size:14px;line-height:24px}.heti h1+h2,.heti h2+h3,.heti h3+h4,.heti h4+h5,.heti h5+h6{margin-block-start:12px}.heti ul,.heti ol,.heti dl{margin-block-start:12px;margin-block-end:24px}.heti ul,.heti ol{padding-inline-start:32px}.heti ul ul,.heti ul ol,.heti ol ul,.heti ol ol{margin-block-start:0;margin-block-end:0}.heti ul{list-style-type:disc}.heti ol{list-style-type:decimal}.heti ul ul,.heti ol ul{list-style-type:circle}.heti ul ul ul,.heti ul ol ul,.heti ol ul ul,.heti ol ol ul{list-style-type:square}.heti li{list-style-type:unset}.heti table{box-sizing:border-box;table-layout:fixed;border-collapse:collapse;border:1px solid #ccc;margin-block-start:12px;margin-block-end:24px;margin-inline-start:auto;margin-inline-end:auto;word-break:break-word}.heti th,.heti td{border:1px solid #ccc;padding-block-start:6px;padding-block-end:6px;padding-inline-start:8px;padding-inline-end:8px}.heti caption{caption-side:bottom;margin-block-start:2px;margin-block-end:-4px;font-size:14px;line-height:24px}.heti a{text-decoration:none}.heti a:hover{padding-block-end:1px;border-block-end:1px solid currentColor;text-decoration:none}.heti abbr[title]{padding-block-end:1px;border-block-end:1px dotted;text-decoration:none;cursor:help}.heti b,.heti strong{font-weight:600}.heti code{margin-inline-start:0.25em;margin-inline-end:0.25em;font-family:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:0.875em}.heti dfn{font-weight:600}.heti dfn:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti dfn:not(:lang(zh)){font-weight:400}.heti em{font-weight:600}.heti figcaption{display:inline-block;vertical-align:top;font-size:14px;text-align:start}.heti i{font-style:italic}.heti ins,.heti u{padding-block-end:1px;border-block-end:1px solid;text-decoration:none}.heti mark{padding-block-start:2px;padding-block-end:2px;padding-inline-start:1px;padding-inline-end:1px;margin-inline-start:1px;margin-inline-end:1px;background-color:rgba(255,247,0,0.88)}.heti q{quotes:"「" "」" "『" "』"}.heti q:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti q:not(:lang(zh)){quotes:initial;quotes:auto}.heti rt{font-size:0.875em;color:rgba(0,0,0,0.88)}.heti small{font-size:0.875em}.heti strong{font-weight:600}.heti sub,.heti sup{position:relative;margin-inline-start:0.25em;margin-inline-end:0.25em;font-size:0.75em;font-family:"Helvetica Neue",Helvetica,Arial,"Heti Hei",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";line-height:1;vertical-align:baseline}.heti sub{bottom:-0.25em}.heti sup{top:-0.5em}.heti summary{padding-inline-start:1em;outline:0;cursor:pointer}.heti summary::-webkit-details-marker{width:0.6em;margin-inline-end:0.4em}.heti u[title]{cursor:help;border-block-end-color:rgba(0,0,0,0.54);border-block-end-width:3px;border-block-end-style:double}.heti address,.heti cite,.heti dfn,.heti dt,.heti em{font-style:normal}.heti address:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti address:not(:lang(zh)),.heti cite:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti cite:not(:lang(zh)),.heti dfn:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti dfn:not(:lang(zh)),.heti dt:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti dt:not(:lang(zh)),.heti em:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti em:not(:lang(zh)){font-style:italic}.heti abbr[title],.heti del,.heti ins,.heti s,.heti u{margin-inline-start:1px;margin-inline-end:1px}.heti,.heti--sans{font-family:"Helvetica Neue",Helvetica,Arial,"Heti Hei",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.heti--serif{font-family:"Times New Roman",Times,"Heti Song",serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.heti--classic{font-family:"Times New Roman",Times,"Heti Song",serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.heti--classic h1,.heti--classic h2,.heti--classic h3,.heti--classic h4,.heti--classic h5,.heti--classic h6{font-family:"Times New Roman",Times,"Heti Kai Black",serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-weight:800}.heti--classic blockquote,.heti--classic cite,.heti--classic q{font-family:"Times New Roman",Times,"Heti Kai",serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.heti--classic figcaption,.heti--classic caption,.heti--classic th{font-family:"Helvetica Neue",Helvetica,Arial,"Heti Hei",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.heti--hei{font-family:"Helvetica Neue",Helvetica,Arial,"Heti Hei",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.heti--song{font-family:"Times New Roman",Times,"Heti Song",serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.heti--kai{font-family:"Times New Roman",Times,"Heti Kai",serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.heti--columns-1,.heti--columns-2,.heti--columns-3,.heti--columns-4,.heti--columns-16em,.heti--columns-20em,.heti--columns-24em,.heti--columns-28em,.heti--columns-32em,.heti--columns-36em,.heti--columns-40em,.heti--columns-44em,.heti--columns-48em,.heti comma{max-width:none;column-gap:2em}.heti--columns-1 p,.heti--columns-2 p,.heti--columns-3 p,.heti--columns-4 p,.heti--columns-16em p,.heti--columns-20em p,.heti--columns-24em p,.heti--columns-28em p,.heti--columns-32em p,.heti--columns-36em p,.heti--columns-40em p,.heti--columns-44em p,.heti--columns-48em p,.heti comma p{margin-block-start:6px;margin-block-end:12px;text-indent:2em}.heti--columns-1{column-count:1}.heti--columns-2{column-count:2}.heti--columns-3{column-count:3}.heti--columns-4{column-count:4}.heti--columns-16em{column-width:16em}.heti--columns-20em{column-width:20em}.heti--columns-24em{column-width:24em}.heti--columns-28em{column-width:28em}.heti--columns-32em{column-width:32em}.heti--columns-36em{column-width:36em}.heti--columns-40em{column-width:40em}.heti--columns-44em{column-width:44em}.heti--columns-48em{column-width:48em}.heti--vertical{max-width:none;max-height:42em;writing-mode:vertical-rl;letter-spacing:0.125em}.heti--vertical h1,.heti--vertical h2,.heti--vertical h3,.heti--vertical h4,.heti--vertical h5,.heti--vertical h6{text-align:start}.heti--ancient,.heti--poetry{font-family:"Times New Roman",Times,"Heti Song",serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.heti--ancient h1,.heti--ancient h2,.heti--ancient h3,.heti--ancient h4,.heti--ancient h5,.heti--ancient h6,.heti--poetry h1,.heti--poetry h2,.heti--poetry h3,.heti--poetry h4,.heti--poetry h5,.heti--poetry h6{font-family:"Times New Roman",Times,"Heti Kai Black",serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-weight:800;text-align:center}.heti--ancient h1 .heti-meta,.heti--ancient h2 .heti-meta,.heti--ancient h3 .heti-meta,.heti--ancient h4 .heti-meta,.heti--ancient h5 .heti-meta,.heti--ancient h6 .heti-meta,.heti--poetry h1 .heti-meta,.heti--poetry h2 .heti-meta,.heti--poetry h3 .heti-meta,.heti--poetry h4 .heti-meta,.heti--poetry h5 .heti-meta,.heti--poetry h6 .heti-meta{font-weight:400}@media screen and (min-width: 640px){.heti--ancient h1 .heti-meta,.heti--ancient h2 .heti-meta,.heti--ancient h3 .heti-meta,.heti--ancient h4 .heti-meta,.heti--ancient h5 .heti-meta,.heti--ancient h6 .heti-meta,.heti--poetry h1 .heti-meta,.heti--poetry h2 .heti-meta,.heti--poetry h3 .heti-meta,.heti--poetry h4 .heti-meta,.heti--poetry h5 .heti-meta,.heti--poetry h6 .heti-meta{position:absolute;line-height:inherit;text-indent:0;display:inline;margin-block-start:4px;margin-inline-start:8px}}.heti--ancient .heti-meta,.heti--poetry .heti-meta{line-height:24px;text-align:center;text-indent:0}.heti--ancient p{text-indent:2em}.heti--poetry p{text-align:center;text-indent:0}.heti--annotation p{margin-block-start:0;margin-block-end:0;line-height:2.25;text-indent:2em}.heti--annotation em{-webkit-text-emphasis:filled circle;-webkit-text-emphasis-position:under;font-weight:400}.heti--annotation em:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti--annotation em:not(:lang(zh)){-webkit-text-emphasis:none}.heti--annotation .heti-meta{margin-block-start:12px;margin-block-end:24px}.heti .heti-meta{display:block;text-indent:0}.heti .heti-verse{text-align:center;text-indent:0}.heti .heti-large{font-size:18px;line-height:24px}.heti .heti-x-large{font-size:20px;line-height:30px}.heti .heti-small{font-size:14px;line-height:24px}.heti .heti-x-small{font-size:12px;line-height:18px}.heti .heti-list-latin{list-style-type:upper-latin}.heti .heti-list-latin ol{list-style-type:lower-roman}.heti .heti-list-latin ol ol{list-style-type:lower-latin}.heti .heti-list-han{list-style-type:cjk-ideographic}.heti .heti-list-han ol{list-style-type:decimal}.heti .heti-list-han ol ol{list-style-type:decimal-leading-zero}.heti .heti-fn{margin-block-start:59px;border-block-start:1px solid #ccc;font-size:14px;font-family:"Helvetica Neue",Helvetica,Arial,"Heti Hei",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";line-height:24px}.heti .heti-fn ol{margin-block-start:12px;margin-block-end:0}.heti .heti-hang{position:absolute;line-height:inherit;text-indent:0}.heti .heti-em{-webkit-text-emphasis:filled circle;-webkit-text-emphasis-position:under}.heti .heti-em:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti .heti-em:not(:lang(zh)){-webkit-text-emphasis:none} diff --git a/demo/index.css b/demo/index.css new file mode 100644 index 0000000..d723adf --- /dev/null +++ b/demo/index.css @@ -0,0 +1,316 @@ +/** + * Author: Sivan [sun.sivan@gmail.com] + */ + +/** 测试用代码段 开始 **/ + +/* 简单模拟 css reset */ +* { + margin: 0; + padding: 0; +} + +ul, +ol { + list-style: none; +} + +/* 模拟不知道哪里流传出来的垃圾代码 */ +ul, +li { + list-style: none; +} + +/** 测试用代码段 结束 **/ + +/** 基础样式 **/ +body { + background-color: #fff; +} + +a { + color: #4285f4; + text-decoration: none; +} + +.container { + box-sizing: border-box; + padding-block-start: 12px; + padding-block-end: 12px; + padding-inline-start: 12px; + padding-inline-end: 12px; +} + +/** 首页样式 **/ +.article { + margin-inline-start: auto; + margin-inline-end: auto; + outline: 1px solid transparent; +} + +.article[data-bg-grid="grid-24"] { + background-size: 100% 24px; + background-image: linear-gradient(to right, rgba(255, 255, 255, 0) 31px, #eee 1px, rgba(255, 255, 255, 0) 33px), + linear-gradient(rgba(255, 255, 255, 0) 23px, #eee 1px); + outline-color: #eee; +} + +.article[data-bg-grid="grid-24"] .heti--vertical { + background-size: 24px 100%; + background-image: linear-gradient(to left, rgba(255, 255, 255, 0) 23px, #eee 1px); + outline: 1px solid #eee; +} + +.article[data-bg-grid="grid-12"] { + background-size: 100% 12px; + background-image: linear-gradient(to right, rgba(255, 255, 255, 0) 31px, #eee 1px, rgba(255, 255, 255, 0) 33px), + linear-gradient(rgba(255, 255, 255, 0) 11px, #eee 12px); + outline-color: #eee; +} + +.article[data-bg-grid="grid-12"] .heti--vertical { + background-size: 12px 100%; + background-image: linear-gradient(to left, transparent 11px, #eee 1px); + outline: 1px solid #eee; +} + +.anchor { + margin-inline-start: 0.25em; +} + +/** 导航样式 **/ +.article .article__toc ol { + margin-block-start: 24px; + margin-block-end: 24px; +} + +/** 控制栏样式 **/ +.panel { + position: fixed; + z-index: 2; + right: 12px; + top: 12px; + display: flex; + text-align: right; +} + +.switch-list { + display: inline-flex; + margin: 0; + padding: 0; + margin-inline-start: 12px; + list-style-type: none; +} + +.switch-list li { + margin-inline-end: -1px; +} + +.switch-list input { + display: none; +} + +.switch-list label { + position: relative; + display: block; + box-sizing: border-box; + height: 24px; + padding: 0; + padding-inline-start: 10px; + padding-inline-end: 10px; + border: 1px solid #c2c2c2; + border-block-start-color: #c9c9c9; + border-block-end-color: #a6a6a6; + font-size: 14px; + line-height: 22px; + text-align: center; + background-color: #fff; + color: #000; + user-select: none; +} + +.switch-list label:active { + background-color: #f0f0f0; +} + +.switch-list li:first-child label { + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; +} + +.switch-list li:last-child label { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; +} + +.switch-list input:checked + label { + z-index: 1; + border-color: #98989e; + border-block-start-color: #a5a5ab; + border-block-end-color: #7e7e84; + background-image: linear-gradient(to bottom, #b1b1b6, #929297); + color: rgba(255, 255, 255, 1); +} + +.switch-list input:checked + label:active { + border-color: #65656b; + border-block-start-color: #808086; + border-block-end-color: #414147; + background-image: linear-gradient(to bottom, #919196, #57575c); + color: rgba(255, 255, 255, 0.95); +} + +/** 演示卡片 **/ +.card { + position: relative; + left: -12px; + width: 100%; + margin-block-start: 24px; + margin-block-end: 48px; + padding-block-start: 12px; + padding-block-end: 12px; + padding-inline-start: 12px; + padding-inline-end: 12px; + border-radius: 2px; + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16); + background-color: #fff; +} + +.article .card { + text-align: left; +} + +.article .card > figcaption { + display: inline-block; + margin-block-start: 16px; + padding-block-start: 4px; + padding-block-end: 3px; + padding-inline-start: 0; + padding-inline-end: 72px; + line-height: 24px; + border-block-start: 1px solid #eee; +} + +.card__vertical-container { + box-sizing: border-box; + width: 100%; + height: 30em; + border: 1px solid #eee; + overflow: auto; + writing-mode: vertical-rl; +} + +/** 演示区块 **/ +.demo { + margin-block-start: 24px; + margin-block-end: 24px; +} + +.section { + width: 100%; + max-height: 85vh; + margin-block-start: 12px; + margin-block-end: 12px; + overflow: auto; +} + +@media screen and (min-width: 640px) { + body { + min-width: 900px; + background-color: #eee; + } + + .container { + box-sizing: border-box; + width: 75%; + min-width: 720px; + max-width: 880px; + margin-block-start: 48px; + margin-block-end: 72px; + margin-inline-start: auto; + margin-inline-end: auto; + padding-block-start: 48px; + padding-block-end: 48px; + padding-inline-start: 48px; + padding-inline-end: 48px; + border-radius: 2px; + box-shadow: 0 8px 32px rgba(0, 0, 0, 0.32); + background-color: #fff; + } + + .article h1, + .article h2, + .article h3, + .article h4, + .article h5, + .article h6 { + position: relative; + } + + .article h1:hover .anchor, + .article h2:hover .anchor, + .article h3:hover .anchor, + .article h4:hover .anchor, + .article h5:hover .anchor, + .article h6:hover .anchor { + opacity: 1; + } + + .article .anchor { + position: absolute; + left: -1em; + width: 1em; + margin-inline-start: 0; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-weight: 400; + line-height: inherit; + text-align: center; + opacity: 0; + transition: opacity 0.2s linear; + } + + .article .anchor:hover { + text-decoration: none; + border: 0; + } + + .card { + box-sizing: border-box; + left: -20%; + width: 140%; + padding-block-start: 24px; + padding-block-end: 24px; + padding-inline-start: 32px; + padding-inline-end: 32px; + } + + .section { + max-height: none; + overflow: visible; + } +} + +@media screen and (min-width: 900px) { + .article__toc { + position: relative; + z-index: 1; + float: right; + width: 192px; + margin-block-start: -1px; + margin-block-end: 12px; + margin-inline-start: 32px; + margin-inline-end: -16px; + padding-block-start: 12px; + padding-block-end: 12px; + padding-inline-start: 8px; + padding-inline-end: 8px; + border: 1px solid #eee; + border-radius: 2px; + background-color: #fff; + } + + .article .article__toc ol { + margin-block-start: 12px; + margin-block-end: 0; + } +} diff --git a/demo/index.html b/demo/index.html new file mode 100644 index 0000000..4eaf11c --- /dev/null +++ b/demo/index.html @@ -0,0 +1,523 @@ + + + + + 赫蹏 - 一个简约又简单的网页中文排版增强 + + + + + + + +
+
+

赫蹏

+
古代称用以书写的小幅绢帛。后亦以借指纸。《汉书·外戚传下·孝成赵皇后》:武(籍武 )发篋中,有裹药二枚,赫蹏书。颜师古注:邓展曰:赫音兄弟鬩墙之鬩。应劭曰:赫蹏,薄小纸也。赵彦卫 《云麓漫钞》卷七:《赵后传》所谓『赫蹏』者,注云薄小纸,然其寔亦縑帛。
+ + + +

介绍#

+

赫蹏hètí)是专为中文内容展示设计的排版样式增强。它基于通行的中文排版规范而来,可以为网站的读者带来更好的文章阅读体验。由于它不同于传统的网页样式重置,而是专注于正文区域的样式增强,因此可以很好的与常见的CSS样式重置方案共存。

+ +

总之,用上就会变好看。

+ +
+ +

使用方法#

+

赫蹏的使用方法很简单,只需要引入样式文件并设定作用范围即可:

+
    +
  1. + 在页面的<head>标签中引入heti.css文件: +
    <link rel="stylesheet" href="./heti.css">
    +
  2. +
  3. + 在要作用的容器元素上增加class="heti"的类名即可: +
    <article class="entry heti">
    +  <h1>我的世界观</h1>
    +  <p>有钱人的生活就是这么朴实无华,且枯燥</p>
    +  ……
    +</article>
    +
  4. +
  5. 不建议将样式作用在根标签(比如<body><div class="container">)上,除非你的页面通篇都是文章的一部分
  6. +
+ +
+ +

效果示例#

+

本站已全页应用了赫蹏样式,下面是赫蹏在特殊排版下的效果演示。

+
+ 示例1:古文 +
+
+

出师表

+

作者:諸葛亮(181年~234年10月8日)

+

先帝创业未半而中道崩殂,今天下三分,益州疲弊,此诚危急存亡之秋也。然侍卫之臣不懈于内,忠志之士忘身于外者,盖追先帝之殊遇,欲报之于陛下也。诚宜开张圣听,以光先帝遗德,恢弘志士之气,不宜妄自菲薄,引喻失义,以塞忠谏之路也。

+

宫中府中,俱为一体;陟罚臧否,不宜异同。若有作奸犯科及为忠善者,宜付有司论其刑赏,以昭陛下平明之理;不宜偏私,使内外异法也。

+

侍中、侍郎郭攸之、费祎、董允等,此皆良实,志虑忠纯,是以先帝简拔以遗陛下:愚以为宫中之事,事无大小,悉以咨之,然后施行,必能裨补阙漏,有所广益。

+

将军向宠,性行淑均,晓畅军事,试用于昔日,先帝称之曰能,是以众议举宠为督。愚以为营中之事,悉以咨之,必能使行阵和睦,优劣得所。

+

亲贤臣,远小人,此先汉所以兴隆也;亲小人,远贤臣,此后汉所以倾颓也。先帝在时,每与臣论此事,未尝不叹息痛恨于桓、灵也。侍中、尚书、长史、参军,此悉贞良死节之臣,愿陛下亲之信之,则汉室之隆,可计日而待也。

+

臣本布衣,躬耕于南阳,苟全性命于乱世,不求闻达于诸侯。先帝不以臣卑鄙,猥自枉屈,三顾臣于草庐之中,咨臣以当世之事,由是感激,遂许先帝以驱驰。后值倾覆,受任于败军之际,奉命于危难之间,尔来二十有一年矣。

+

先帝知臣谨慎,故临崩寄臣以大事也。受命以来,夙夜忧叹,恐托付不效,以伤先帝之明;故五月渡泸,深入不毛。今南方已定,兵甲已足,当奖率三军,北定中原,庶竭驽钝,攘除奸凶,兴复汉室,还于旧都。此臣所以报先帝而忠陛下之职分也。至于斟酌损益,进尽忠言,则攸之、祎、允之任也。

+

愿陛下托臣以讨贼兴复之效,不效,则治臣之罪,以告先帝之灵。若无兴德之言,则责攸之、祎、允等之慢,以彰其咎;陛下亦宜自谋,以咨诹善道,察纳雅言,深追先帝遗诏。臣不胜受恩感激。

+

今当远离,临表涕零,不知所言。

+
+
+
+ +
+ 示例2:诗词 +
+
+

一剪梅·红藕香残玉簟秋[宋]李清照

+

+ 红藕香残玉簟秋。轻解罗裳,独上兰舟
+ 云中谁寄锦书来,雁字回时,月满西楼
+ 花自飘零水自流。一种相思,两处闲愁
+ 此情无计可消除,才下眉头,却上心头 +

+
+
+
+

丑奴儿·书博山道中壁[宋]辛弃疾

+

+ 少年不识愁滋味,爱上层楼
+ 爱上层楼,为赋新词强说愁
+ 而今识尽愁滋味,欲说还休
+ 欲说还休,却道天凉好个秋 +

+
+
+
+ +
+ 示例3:行间注 +
+
+

庖丁解牛

+

作者:庄周(公元前369~公元前286年)

+

吾生也有涯,而知也无涯。以有涯随无涯,殆已!已而为知者,殆而已矣!为善无近名,为恶无近刑。缘督以为经,可以保身,可以全生,可以养亲,可以尽年。

+

(páo)为文惠君解牛,手之所触,肩之所倚,足之所履,膝之所()(huā)(xiǎng)然,奏刀(huō),莫不中音。合于《桑林》之舞,乃中《经首》之会。

+

文惠君曰:「嘻,善哉!技()至此乎?」

+

庖丁释刀对曰:「臣之所好者,道也,进乎技矣。始臣之解牛之时,所见无非牛者。三年之后,未尝见全牛也。方今之时,臣以神遇而不以目视,官知止而神欲行。依乎天理批大()导大(kuǎn)固然,技经肯(qìng)之未尝,而况大()乎!良庖岁更刀,割也;族庖月更刀,折也。今臣之刀十九年矣,所解数千牛矣,而刀刃若新发于(xíng)。彼节者有间,而刀刃者无厚;以无厚入有间,恢恢乎其于游刃必有余地矣,是以十九年而刀刃若新发于硎。虽然,每至于族,吾见其难为,(chù)然为戒,视为止,行为迟。动刀甚微,(huò)然已解,如土委地。提刀而立,为之四顾,为之(chóu)(chú)满志,善刀而藏之。」

+

文惠君曰:「善哉!吾闻庖丁之言,得养生焉。」

+
+
+
+ +
+ 示例4:英文演示 +
+
+

Lorem Ipsum

+

There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain...

+

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

+

Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.

+

The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.

+
+
+
+ +
+ +

多栏排版#

+

赫蹏预置了多种多栏布局类,可以按栏数或栏宽进行设置。

+
+ 查看使用说明 +

为容器元素添加名为heti--columns-2class即可实现三栏排版。

+
<div class="heti heti--columns-2"></div>
+ + + + + + + + + + + + + + + + + + + + +
方式对应类名可选数值
按数量heti--columns-32, 3, 4
按宽度heti--columns-16em16em, 20em, 24em, … +4em, … , 48em
+
+
+
+

先帝创业未半而中道崩殂,今天下三分,益州疲弊,此诚危急存亡之秋也。然侍卫之臣不懈于内,忠志之士忘身于外者,盖追先帝之殊遇,欲报之于陛下也。诚宜开张圣听,以光先帝遗德,恢弘志士之气,不宜妄自菲薄,引喻失义,以塞忠谏之路也。

+

宫中府中,俱为一体;陟罚臧否,不宜异同。若有作奸犯科及为忠善者,宜付有司论其刑赏,以昭陛下平明之理;不宜偏私,使内外异法也。

+

侍中、侍郎郭攸之、费祎、董允等,此皆良实,志虑忠纯,是以先帝简拔以遗陛下:愚以为宫中之事,事无大小,悉以咨之,然后施行,必能裨补阙漏,有所广益。

+

将军向宠,性行淑均,晓畅军事,试用于昔日,先帝称之曰能,是以众议举宠为督。愚以为营中之事,悉以咨之,必能使行阵和睦,优劣得所。

+

亲贤臣,远小人,此先汉所以兴隆也;亲小人,远贤臣,此后汉所以倾颓也。先帝在时,每与臣论此事,未尝不叹息痛恨于桓、灵也。侍中、尚书、长史、参军,此悉贞良死节之臣,愿陛下亲之信之,则汉室之隆,可计日而待也。

+

臣本布衣,躬耕于南阳,苟全性命于乱世,不求闻达于诸侯。先帝不以臣卑鄙,猥自枉屈,三顾臣于草庐之中,咨臣以当世之事,由是感激,遂许先帝以驱驰。后值倾覆,受任于败军之际,奉命于危难之间,尔来二十有一年矣。

+

先帝知臣谨慎,故临崩寄臣以大事也。受命以来,夙夜忧叹,恐托付不效,以伤先帝之明;故五月渡泸,深入不毛。今南方已定,兵甲已足,当奖率三军,北定中原,庶竭驽钝,攘除奸凶,兴复汉室,还于旧都。此臣所以报先帝而忠陛下之职分也。至于斟酌损益,进尽忠言,则攸之、祎、允之任也。

+

愿陛下托臣以讨贼兴复之效,不效,则治臣之罪,以告先帝之灵。若无兴德之言,则责攸之、祎、允等之慢,以彰其咎;陛下亦宜自谋,以咨诹善道,察纳雅言,深追先帝遗诏。臣不胜受恩感激。

+

今当远离,临表涕零,不知所言。

+
+
多栏排版演示
+
+ +
+ +

垂直排版#

+

赫蹏预置了传统的垂直方向排版,同样贴合栅格。

+
+ 查看使用说明 +

为容器元素添加名为heti--verticalclass即可实现垂直布局:

+
<div class="heti heti--vertical"></div>
+
+
+
+
+

出師表

+

作者:諸葛亮(181年-234年10月8日)

+

先帝創業未半,而中道崩殂;今天下三分,益州疲弊,此誠危急存亡之秋也﹗然侍衞之臣,不懈於內;忠志之士,忘身於外者,蓋追先帝之殊遇,欲報之於陛下也。

+

誠宜開張聖聽,以光先帝遺德,恢弘志士之氣﹔不宜妄自菲薄,引喻失義,以塞忠諫之路也。

+

宮中、府中,俱為一體;陟罰臧否,不宜異同。若有作姦、犯科,及為忠善者,宜付有司,論其刑賞,以昭陛下平明之治;不宜偏私,使內外異法也。

+

侍中、侍郎郭攸之、費禕、董允等,此皆良實,志慮忠純,是以先帝簡拔以遺陛下。愚以為宮中之事,事無大小,悉以咨之,然後施行,必能裨補闕漏,有所廣益。將軍向寵,性行淑均,曉暢軍事,試用於昔日,先 帝稱之曰「能」,是以眾議舉寵為督。愚以為營中之事,悉以咨之,必能使行陣和睦,優劣得所。

+

親賢臣,遠小人,此先漢所以興隆也﹔親小人,遠賢臣,此後漢所以傾頹也。先帝在時,每與臣論此事,未嘗不歎息痛恨於桓、靈也!侍中、尚書、長史、參軍,此悉貞良死節之臣,願陛下親之、信之,則漢室之隆,可計日而待也。

+

臣本布衣,躬耕於南陽,苟全性命於亂世,不求聞達於諸侯。先帝不以臣卑鄙,猥自枉屈,三顧臣於草廬之中,諮臣以當世之事;由是感激,遂許先帝以驅馳。後值傾覆,受任於敗軍之際,奉命於危難之間,爾來二十有一年矣。先帝知臣謹慎,故臨崩寄臣以大事也。受命以來,夙夜憂歎,恐託付不效,以傷先帝之明。故五月渡瀘,深入不毛。今南方已定,兵甲已足,當獎率三軍,北定中原,庶竭駑鈍,攘除姦凶,興復漢室,還於舊都。此臣所以報先帝而忠陛下之職分也。至於斟酌損益,進盡忠言,則攸之、禕、允之任也。

+

願陛下託臣以討賊興復之效;不效,則治臣之罪,以告先帝之靈。若無興德之言,則責攸之、禕、允等之慢,以彰其咎。陛下亦宜自謀,以諮諏善道,察納雅言,深追先帝遺詔。臣不勝受恩感激。今當遠離,臨表涕零,不知所言!

+
+
+
垂直排版演示
+
+ +
+ +

排版原则#

+

核心

+

以美化中文方块字排版为目标,假定作用范围是网页中的文章区域(含标题、正文、元信息等),不包含网页导航、表单、侧边栏等区域(它们也不需要这套格式排版)。

+

使用heti.css时建议搭配良好的中文书写习惯,即:使用正确的HTML标签、正确的引号、中文全角标点等。使用Markdown书写文章将助你一臂之力。

+

字号

+

heti.css 采用16px作为默认字号。在文字较大时(作用于标题等情况),会适当地增加字间距以便获得更好地可读性。

+

字体

+

参考《中文排版需求[3]》中描述的四种常见书籍排版字体:宋体、楷体、黑体、仿宋。赫蹏提供黑体、宋体和传统三种字体风格,前两者分别对应无衬线、衬线字体族。

+
+ 查看对照表 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
各字体族下不同标签对应的字体
黑体宋体传统备注
标题黑体宋体(粗)楷体 +
+

记忆中的站台

+
+
正文黑体宋体宋体 +
+

那是一个风雨交加的夜晚。

+
+
引用黑体宋体楷体 +
+
锣鼓喧天,鞭炮齐鸣,红旗招展,人山人海。
+
+
强调黑体宋体宋体 +
+

父亲特意嘱咐了我两句。

+
+
对话黑体宋体楷体 +
+

他说:我买几个橘子去。你就在此地,不要走动。

+
+
图例黑体宋体黑体 +
+
+ +
橘子
+
+
+
表头黑体宋体黑体 +
+ + + + + + + + + + + + + + +
当时的情形
角色物品
父亲橘子
车票
+
+
角标黑体黑体黑体鲁迅[1]曾经没有说过
+
+
+

标点

+

参考《中文排版需求》制定符号样式。唯一差异在于简体中文一律采用直角引号(「」)替代圆角引号(“”),这样可以保持字符等宽。

+

间距

+

为保持页面元素总是贴合垂直栅格,大部分块级元素(段落、列表、表格等)采用一行行高作为底边距,半行行高作为顶边距。

+ +
+ +

附录#

+

兼容性#

+

赫蹏在间距、边框、位置属性上采用了Logical properties,在所有现代浏览器上表现良好。

+
+ 查看兼容性列表 +
+ + + + + + + + + + + + + + + + + + +
兼容性列表(未经充分测试)
ChromeSafariFirefoxIEEdge
兼容性43.13暂未支持79
+
+
+ +

标签示例表#

+
+ 查看标签示例表 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
常用标签样式示例表
类型标签效果
链接<a href="https://github.com/sivan/heti" title="赫蹏" target="_blank">heti.css</a>heti.css
缩写<abbr title="Cascading Style Sheets">CSS</abbr>CSS
代码<code>.heti { star: 5; }</code>.heti { star: 5; }
专名号此时来自<u title="位于山东省聊城市阳谷县城东">景阳冈</u>的<u>武松</u>大喝一声:<q>纳命来!</q>此时来自景阳冈武松大喝一声:纳命来!
文本变动这次考试,我考了<del datetime="17:00:00">97</del><ins datetime="18:15:00">100</ins>分呢!这次考试,我考了97100分呢!
文本更新因为谁也不认识,所以最后我们决定念<s>dí</s> tí。因为谁也不认识,所以最后我们决定念tí。
引号窃·格瓦拉曾经说过:<q>打工是不可能打工的。</q>窃·格瓦拉曾经说过:打工是不可能打工的。
术语<dfn>窃·格瓦拉</dfn>,中国大陆网络红人、罪犯。被奉为百度「戒赌吧」400万会员的「精神领袖」。窃·格瓦拉,中国大陆网络红人、罪犯。被奉为百度「戒赌吧」400万会员的「精神领袖」。
强调稳住,<em>我们能赢</em>!稳住,我们能赢
着重号我们<span class="heti-em">必将</span>战胜这场疫情。我们必将战胜这场疫情。
标记这道题<mark>必考</mark>,你们爱记不记。这道题必考,你们爱记不记。
+
+
+ +

开源协议#

+

「赫蹏」遵循MIT协议开源。

+ +
+ +

待开发功能#

+ + + +
+
+ + + + + + diff --git a/demo/normalize.css b/demo/normalize.css new file mode 100644 index 0000000..192eb9c --- /dev/null +++ b/demo/normalize.css @@ -0,0 +1,349 @@ +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ + +/* Document + ========================================================================== */ + +/** + * 1. Correct the line height in all browsers. + * 2. Prevent adjustments of font size after orientation changes in iOS. + */ + +html { + line-height: 1.15; /* 1 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/* Sections + ========================================================================== */ + +/** + * Remove the margin in all browsers. + */ + +body { + margin: 0; +} + +/** + * Render the `main` element consistently in IE. + */ + +main { + display: block; +} + +/** + * Correct the font size and margin on `h1` elements within `section` and + * `article` contexts in Chrome, Firefox, and Safari. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/* Grouping content + ========================================================================== */ + +/** + * 1. Add the correct box sizing in Firefox. + * 2. Show the overflow in Edge and IE. + */ + +hr { + box-sizing: content-box; /* 1 */ + height: 0; /* 1 */ + overflow: visible; /* 2 */ +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +pre { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Remove the gray background on active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * 1. Remove the bottom border in Chrome 57- + * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. + */ + +abbr[title] { + border-bottom: none; /* 1 */ + text-decoration: underline; /* 2 */ + text-decoration: underline dotted; /* 2 */ +} + +/** + * Add the correct font weight in Chrome, Edge, and Safari. + */ + +b, +strong { + font-weight: bolder; +} + +/** + * 1. Correct the inheritance and scaling of font size in all browsers. + * 2. Correct the odd `em` font sizing in all browsers. + */ + +code, +kbd, +samp { + font-family: monospace, monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** + * Add the correct font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` elements from affecting the line height in + * all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove the border on images inside links in IE 10. + */ + +img { + border-style: none; +} + +/* Forms + ========================================================================== */ + +/** + * 1. Change the font styles in all browsers. + * 2. Remove the margin in Firefox and Safari. + */ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ +} + +/** + * Show the overflow in IE. + * 1. Show the overflow in Edge. + */ + +button, +input { /* 1 */ + overflow: visible; +} + +/** + * Remove the inheritance of text transform in Edge, Firefox, and IE. + * 1. Remove the inheritance of text transform in Firefox. + */ + +button, +select { /* 1 */ + text-transform: none; +} + +/** + * Correct the inability to style clickable types in iOS and Safari. + */ + +button, +[type="button"], +[type="reset"], +[type="submit"] { + -webkit-appearance: button; +} + +/** + * Remove the inner border and padding in Firefox. + */ + +button::-moz-focus-inner, +[type="button"]::-moz-focus-inner, +[type="reset"]::-moz-focus-inner, +[type="submit"]::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** + * Restore the focus styles unset by the previous rule. + */ + +button:-moz-focusring, +[type="button"]:-moz-focusring, +[type="reset"]:-moz-focusring, +[type="submit"]:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** + * Correct the padding in Firefox. + */ + +fieldset { + padding: 0.35em 0.75em 0.625em; +} + +/** + * 1. Correct the text wrapping in Edge and IE. + * 2. Correct the color inheritance from `fieldset` elements in IE. + * 3. Remove the padding so developers are not caught out when they zero out + * `fieldset` elements in all browsers. + */ + +legend { + box-sizing: border-box; /* 1 */ + color: inherit; /* 2 */ + display: table; /* 1 */ + max-width: 100%; /* 1 */ + padding: 0; /* 3 */ + white-space: normal; /* 1 */ +} + +/** + * Add the correct vertical alignment in Chrome, Firefox, and Opera. + */ + +progress { + vertical-align: baseline; +} + +/** + * Remove the default vertical scrollbar in IE 10+. + */ + +textarea { + overflow: auto; +} + +/** + * 1. Add the correct box sizing in IE 10. + * 2. Remove the padding in IE 10. + */ + +[type="checkbox"], +[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Correct the cursor style of increment and decrement buttons in Chrome. + */ + +[type="number"]::-webkit-inner-spin-button, +[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Correct the odd appearance in Chrome and Safari. + * 2. Correct the outline style in Safari. + */ + +[type="search"] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** + * Remove the inner padding in Chrome and Safari on macOS. + */ + +[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * 1. Correct the inability to style clickable types in iOS and Safari. + * 2. Change font properties to `inherit` in Safari. + */ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} + +/* Interactive + ========================================================================== */ + +/* + * Add the correct display in Edge, IE 10+, and Firefox. + */ + +details { + display: block; +} + +/* + * Add the correct display in all browsers. + */ + +summary { + display: list-item; +} + +/* Misc + ========================================================================== */ + +/** + * Add the correct display in IE 10+. + */ + +template { + display: none; +} + +/** + * Add the correct display in IE 10. + */ + +[hidden] { + display: none; +} diff --git a/demo/orange.jpg b/demo/orange.jpg new file mode 100644 index 0000000..66f941e Binary files /dev/null and b/demo/orange.jpg differ diff --git a/dist/heti.min.css b/dist/heti.min.css new file mode 100644 index 0000000..6d52fd4 --- /dev/null +++ b/dist/heti.min.css @@ -0,0 +1,5 @@ +/*! + * Project: Heti + * URL: https://github.com/sivan/heti + * Author: Sivan [sun.sivan@gmail.com] + */@font-face{font-family:"Heti Hei";src:local("PingFang SC Regular"),local("PingFang TC Regular"),local("Hiragino Sans GB W3"),local("Heiti SC Regular"),local("Heiti TC Regular"),local("Microsoft YaHei"),local("Microsoft Jhenghei"),local("Source Han Sans CN Regular"),local("Source Han Sans HK Regular"),local("Source Han Sans TW Regular"),local("Source Han Sans JP Regular"),local("Source Han Sans KR Regular"),local("Noto Sans CJK SC Regular"),local("Noto Sans CJK TC Regular"),local("Noto Sans CJK JP Regular"),local("Noto Sans CJK KR Regular"),local("WenQuanYi Micro Hei"),local("Droid Sans Fallback")}@font-face{font-family:"Heti Hei";font-weight:200;src:local("PingFang SC Light"),local("PingFang TC Light"),local("Heiti SC Light"),local("Heiti TC Light"),local("Microsoft YaHei Light"),local("Microsoft Jhenghei Light"),local("Source Han Sans CN Light"),local("Source Han Sans HK Light"),local("Source Han Sans TW Light"),local("Source Han Sans JP Light"),local("Source Han Sans KR Light"),local("Noto Sans CJK SC Light"),local("Noto Sans CJK TC Light"),local("Noto Sans CJK JP Light"),local("Noto Sans CJK KR Light")}@font-face{font-family:"Heti Hei";font-weight:600;src:local("PingFang SC Medium"),local("Hiragino Sans GB W6"),local("PingFang TC Medium"),local("Heiti SC Medium"),local("Heiti TC Medium"),local("Microsoft YaHei Bold"),local("Microsoft Jhenghei Bold"),local("Source Han Sans CN Bold"),local("Source Han Sans HK Bold"),local("Source Han Sans TW Bold"),local("Source Han Sans JP Bold"),local("Source Han Sans KR Bold"),local("Noto Sans CJK SC Bold"),local("Noto Sans CJK TC Bold"),local("Noto Sans CJK JP Bold"),local("Noto Sans CJK KR Bold")}@font-face{font-family:"Heti Hei Black";font-weight:800;src:local("Lantinghei SC Heavy"),local("Lantinghei TC Heavy"),local("PingFang SC Semibold"),local("PingFang TC Semibold"),local("Hiragino Sans GB W6"),local("Heiti SC Medium"),local("Heiti TC Medium"),local("Microsoft YaHei Bold"),local("Microsoft Jhenghei Bold"),local("Source Han Sans CN Heavy"),local("Source Han Sans HK Heavy"),local("Source Han Sans TW Heavy"),local("Source Han Sans JP Heavy"),local("Source Han Sans KR Heavy"),local("Noto Sans CJK SC Heavy"),local("Noto Sans CJK TC Heavy"),local("Noto Sans CJK JP Heavy"),local("Noto Sans CJK KR Heavy"),local("Droid Sans Fallback")}@font-face{font-family:"Heti Song";src:local("Songti SC Regular"),local("Songti TC Regular"),local("SimSun")}@font-face{font-family:"Heti Song";font-weight:200;src:local("Songti SC Light"),local("Songti TC Light"),local(STSong),local("SimSun")}@font-face{font-family:"Heti Song";font-weight:600;src:local("Songti SC Bold"),local("Songti TC Bold"),local("SimSun")}@font-face{font-family:"Heti Song Black";font-weight:800;src:local("Songti SC Black"),local("SimSun")}@font-face{font-family:"Heti Kai";src:local("Kaiti SC Regular"),local("Kaiti TC Regular"),local("BiauKai")}@font-face{font-family:"Heti Kai";font-weight:600;src:local("Kaiti SC Bold"),local("Kaiti TC Bold")}@font-face{font-family:"Heti Kai Black";font-weight:800;src:local("Kaiti SC Black"),local("Kaiti TC Black")}.heti{max-width:42em;font-size:16px;font-weight:400;line-height:1.5}.heti::before,.heti::after{content:"";display:table}.heti::after{clear:both}.heti>*:first-child,.heti section>*:first-child,.heti td>*:first-child{margin-block-start:0 !important}.heti>*:last-child,.heti section>*:last-child,.heti td>*:last-child{margin-block-end:0 !important}.heti blockquote{margin-block-start:12px;margin-block-end:24px;margin-inline-start:32px;margin-inline-end:32px;padding-block-start:12px;padding-block-end:12px;padding-inline-start:16px;padding-inline-end:16px;background-color:rgba(0,0,0,0.054)}.heti figure{display:block;text-align:center}.heti figure>img{display:block;margin-inline-start:auto;margin-inline-end:auto}.heti hr{width:30%;height:1px;margin-block-start:48px;margin-block-end:47px;margin-inline-start:auto;margin-inline-end:auto;border:0;background-color:#ddd}.heti p{margin-block-start:12px;margin-block-end:24px;text-align:justify}.heti p:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti p:not(:lang(zh)){text-align:start}.heti pre{margin-block-start:12px;margin-block-end:12px;margin-inline-start:0;margin-inline-end:0;padding-block-start:12px;padding-block-end:12px;padding-inline-start:16px;padding-inline-end:16px;overflow:auto;font-family:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";white-space:pre;word-wrap:normal;background-color:rgba(0,0,0,0.054);border-radius:4px}.heti pre code{margin:0;padding:0;border:0;border-radius:0;background-color:transparent;color:inherit}.heti h1,.heti h2,.heti h3,.heti h4,.heti h5,.heti h6{position:relative;margin:0;margin-block-start:24px;margin-block-end:12px;font-weight:600}.heti h1{margin-block-end:24px;font-size:32px;line-height:48px;letter-spacing:1.6px}.heti h2{font-size:24px;line-height:36px;letter-spacing:1.2px}.heti h3{font-size:20px;line-height:36px;letter-spacing:1px}.heti h4{font-size:18px;line-height:24px}.heti h5{font-size:16px;line-height:24px}.heti h6{font-size:14px;line-height:24px}.heti h1+h2,.heti h2+h3,.heti h3+h4,.heti h4+h5,.heti h5+h6{margin-block-start:12px}.heti ul,.heti ol,.heti dl{margin-block-start:12px;margin-block-end:24px}.heti ul,.heti ol{padding-inline-start:32px}.heti ul ul,.heti ul ol,.heti ol ul,.heti ol ol{margin-block-start:0;margin-block-end:0}.heti ul{list-style-type:disc}.heti ol{list-style-type:decimal}.heti ul ul,.heti ol ul{list-style-type:circle}.heti ul ul ul,.heti ul ol ul,.heti ol ul ul,.heti ol ol ul{list-style-type:square}.heti li{list-style-type:unset}.heti table{box-sizing:border-box;table-layout:fixed;border-collapse:collapse;border:1px solid #ccc;margin-block-start:12px;margin-block-end:24px;margin-inline-start:auto;margin-inline-end:auto;word-break:break-word}.heti th,.heti td{border:1px solid #ccc;padding-block-start:6px;padding-block-end:6px;padding-inline-start:8px;padding-inline-end:8px}.heti caption{caption-side:bottom;margin-block-start:2px;margin-block-end:-4px;font-size:14px;line-height:24px}.heti a{text-decoration:none}.heti a:hover{padding-block-end:1px;border-block-end:1px solid currentColor;text-decoration:none}.heti abbr[title]{padding-block-end:1px;border-block-end:1px dotted;text-decoration:none;cursor:help}.heti b,.heti strong{font-weight:600}.heti code{margin-inline-start:0.25em;margin-inline-end:0.25em;font-family:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,Courier,monospace,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:0.875em}.heti dfn{font-weight:600}.heti dfn:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti dfn:not(:lang(zh)){font-weight:400}.heti em{font-weight:600}.heti figcaption{display:inline-block;vertical-align:top;font-size:14px;text-align:start}.heti i{font-style:italic}.heti ins,.heti u{padding-block-end:1px;border-block-end:1px solid;text-decoration:none}.heti mark{padding-block-start:2px;padding-block-end:2px;padding-inline-start:1px;padding-inline-end:1px;margin-inline-start:1px;margin-inline-end:1px;background-color:rgba(255,247,0,0.88)}.heti q{quotes:"「" "」" "『" "』"}.heti q:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti q:not(:lang(zh)){quotes:initial;quotes:auto}.heti rt{font-size:0.875em;color:rgba(0,0,0,0.88)}.heti small{font-size:0.875em}.heti strong{font-weight:600}.heti sub,.heti sup{position:relative;margin-inline-start:0.25em;margin-inline-end:0.25em;font-size:0.75em;font-family:"Helvetica Neue",Helvetica,Arial,"Heti Hei",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";line-height:1;vertical-align:baseline}.heti sub{bottom:-0.25em}.heti sup{top:-0.5em}.heti summary{padding-inline-start:1em;outline:0;cursor:pointer}.heti summary::-webkit-details-marker{width:0.6em;margin-inline-end:0.4em}.heti u[title]{cursor:help;border-block-end-color:rgba(0,0,0,0.54);border-block-end-width:3px;border-block-end-style:double}.heti address,.heti cite,.heti dfn,.heti dt,.heti em{font-style:normal}.heti address:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti address:not(:lang(zh)),.heti cite:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti cite:not(:lang(zh)),.heti dfn:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti dfn:not(:lang(zh)),.heti dt:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti dt:not(:lang(zh)),.heti em:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti em:not(:lang(zh)){font-style:italic}.heti abbr[title],.heti del,.heti ins,.heti s,.heti u{margin-inline-start:1px;margin-inline-end:1px}.heti,.heti--sans{font-family:"Helvetica Neue",Helvetica,Arial,"Heti Hei",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.heti--serif{font-family:"Times New Roman",Times,"Heti Song",serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.heti--classic{font-family:"Times New Roman",Times,"Heti Song",serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.heti--classic h1,.heti--classic h2,.heti--classic h3,.heti--classic h4,.heti--classic h5,.heti--classic h6{font-family:"Times New Roman",Times,"Heti Kai Black",serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-weight:800}.heti--classic blockquote,.heti--classic cite,.heti--classic q{font-family:"Times New Roman",Times,"Heti Kai",serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.heti--classic figcaption,.heti--classic caption,.heti--classic th{font-family:"Helvetica Neue",Helvetica,Arial,"Heti Hei",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.heti--hei{font-family:"Helvetica Neue",Helvetica,Arial,"Heti Hei",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.heti--song{font-family:"Times New Roman",Times,"Heti Song",serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.heti--kai{font-family:"Times New Roman",Times,"Heti Kai",serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.heti--columns-1,.heti--columns-2,.heti--columns-3,.heti--columns-4,.heti--columns-16em,.heti--columns-20em,.heti--columns-24em,.heti--columns-28em,.heti--columns-32em,.heti--columns-36em,.heti--columns-40em,.heti--columns-44em,.heti--columns-48em,.heti comma{max-width:none;column-gap:2em}.heti--columns-1 p,.heti--columns-2 p,.heti--columns-3 p,.heti--columns-4 p,.heti--columns-16em p,.heti--columns-20em p,.heti--columns-24em p,.heti--columns-28em p,.heti--columns-32em p,.heti--columns-36em p,.heti--columns-40em p,.heti--columns-44em p,.heti--columns-48em p,.heti comma p{margin-block-start:6px;margin-block-end:12px;text-indent:2em}.heti--columns-1{column-count:1}.heti--columns-2{column-count:2}.heti--columns-3{column-count:3}.heti--columns-4{column-count:4}.heti--columns-16em{column-width:16em}.heti--columns-20em{column-width:20em}.heti--columns-24em{column-width:24em}.heti--columns-28em{column-width:28em}.heti--columns-32em{column-width:32em}.heti--columns-36em{column-width:36em}.heti--columns-40em{column-width:40em}.heti--columns-44em{column-width:44em}.heti--columns-48em{column-width:48em}.heti--vertical{max-width:none;max-height:42em;writing-mode:vertical-rl;letter-spacing:0.125em}.heti--vertical h1,.heti--vertical h2,.heti--vertical h3,.heti--vertical h4,.heti--vertical h5,.heti--vertical h6{text-align:start}.heti--ancient,.heti--poetry{font-family:"Times New Roman",Times,"Heti Song",serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}.heti--ancient h1,.heti--ancient h2,.heti--ancient h3,.heti--ancient h4,.heti--ancient h5,.heti--ancient h6,.heti--poetry h1,.heti--poetry h2,.heti--poetry h3,.heti--poetry h4,.heti--poetry h5,.heti--poetry h6{font-family:"Times New Roman",Times,"Heti Kai Black",serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-weight:800;text-align:center}.heti--ancient h1 .heti-meta,.heti--ancient h2 .heti-meta,.heti--ancient h3 .heti-meta,.heti--ancient h4 .heti-meta,.heti--ancient h5 .heti-meta,.heti--ancient h6 .heti-meta,.heti--poetry h1 .heti-meta,.heti--poetry h2 .heti-meta,.heti--poetry h3 .heti-meta,.heti--poetry h4 .heti-meta,.heti--poetry h5 .heti-meta,.heti--poetry h6 .heti-meta{font-weight:400}@media screen and (min-width: 640px){.heti--ancient h1 .heti-meta,.heti--ancient h2 .heti-meta,.heti--ancient h3 .heti-meta,.heti--ancient h4 .heti-meta,.heti--ancient h5 .heti-meta,.heti--ancient h6 .heti-meta,.heti--poetry h1 .heti-meta,.heti--poetry h2 .heti-meta,.heti--poetry h3 .heti-meta,.heti--poetry h4 .heti-meta,.heti--poetry h5 .heti-meta,.heti--poetry h6 .heti-meta{position:absolute;line-height:inherit;text-indent:0;display:inline;margin-block-start:4px;margin-inline-start:8px}}.heti--ancient .heti-meta,.heti--poetry .heti-meta{line-height:24px;text-align:center;text-indent:0}.heti--ancient p{text-indent:2em}.heti--poetry p{text-align:center;text-indent:0}.heti--annotation p{margin-block-start:0;margin-block-end:0;line-height:2.25;text-indent:2em}.heti--annotation em{-webkit-text-emphasis:filled circle;-webkit-text-emphasis-position:under;font-weight:400}.heti--annotation em:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti--annotation em:not(:lang(zh)){-webkit-text-emphasis:none}.heti--annotation .heti-meta{margin-block-start:12px;margin-block-end:24px}.heti .heti-meta{display:block;text-indent:0}.heti .heti-verse{text-align:center;text-indent:0}.heti .heti-large{font-size:18px;line-height:24px}.heti .heti-x-large{font-size:20px;line-height:30px}.heti .heti-small{font-size:14px;line-height:24px}.heti .heti-x-small{font-size:12px;line-height:18px}.heti .heti-list-latin{list-style-type:upper-latin}.heti .heti-list-latin ol{list-style-type:lower-roman}.heti .heti-list-latin ol ol{list-style-type:lower-latin}.heti .heti-list-han{list-style-type:cjk-ideographic}.heti .heti-list-han ol{list-style-type:decimal}.heti .heti-list-han ol ol{list-style-type:decimal-leading-zero}.heti .heti-fn{margin-block-start:59px;border-block-start:1px solid #ccc;font-size:14px;font-family:"Helvetica Neue",Helvetica,Arial,"Heti Hei",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";line-height:24px}.heti .heti-fn ol{margin-block-start:12px;margin-block-end:0}.heti .heti-hang{position:absolute;line-height:inherit;text-indent:0}.heti .heti-em{-webkit-text-emphasis:filled circle;-webkit-text-emphasis-position:under}.heti .heti-em:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)),.heti .heti-em:not(:lang(zh)){-webkit-text-emphasis:none} diff --git a/lib/heti.scss b/lib/heti.scss index c624df0..9608cdb 100644 --- a/lib/heti.scss +++ b/lib/heti.scss @@ -2,7 +2,6 @@ * Project: Heti * URL: https://github.com/sivan/heti * Author: Sivan [sun.sivan@gmail.com] - * Date: 2020-01-22 00:00 */ @import "font"; diff --git a/package.json b/package.json index 8e5dbc8..dd616d0 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,9 @@ "lib": "lib" }, "scripts": { - "start": "node-sass -w --output-style=compressed index.scss dist/heti.css", - "build": "node-sass index.scss dist/heti.css --output-style=compressed", - "deploy": "gh-pages -d dist", + "start": "node-sass -w --output-style=compressed lib/heti.scss demo/heti.min.css", + "build": "node-sass lib/heti.scss dist/heti.min.css --output-style=compressed", + "deploy": "npm run build && gh-pages -d demo", "test": "npx stylelint --config .stylelintrc 'lib/**/*.scss'" }, "repository": { @@ -17,7 +17,11 @@ "url": "git+https://github.com/sivan/heti.git" }, "keywords": [ - "typography" + "typography", + "clreq", + "css", + "sass", + "scss" ], "author": "Sivan ", "license": "MIT",