Browse Source

Theme fixes

simov 2 years ago
parent
commit
c5bad0e943
5 changed files with 186 additions and 41 deletions
  1. 4 2
      build/themes/build.sh
  2. 14 0
      build/themes/fix.js
  3. 159 22
      content/index.css
  4. 7 7
      content/index.js
  5. 2 10
      popup/index.js

+ 4 - 2
build/themes/build.sh

@@ -21,10 +21,10 @@ npx csso --input cleanrmd/inst/resources/bullframe/bullframe.css --output ../../
 npx csso --input cleanrmd/inst/resources/holiday/holiday.css --output ../../themes/holiday.css
 npx csso --input cleanrmd/inst/resources/kacit/kacit.css --output ../../themes/kacit.css
 npx csso --input cleanrmd/inst/resources/latex.css/latex.css --output ../../themes/latex.css
-npx csso --input cleanrmd/inst/resources/markdown-air/markdown-air.css --output ../../themes/air.css
+# npx csso --input cleanrmd/inst/resources/markdown-air/markdown-air.css --output ../../themes/air.css
 npx csso --input cleanrmd/inst/resources/markdown-modest/markdown-modest.css --output ../../themes/modest.css
 npx csso --input cleanrmd/inst/resources/markdown-retro/markdown-retro.css --output ../../themes/retro.css
-npx csso --input cleanrmd/inst/resources/markdown-splendor/markdown-splendor.css --output ../../themes/splendor.css
+# npx csso --input cleanrmd/inst/resources/markdown-splendor/markdown-splendor.css --output ../../themes/splendor.css
 npx csso --input cleanrmd/inst/resources/marx/marx.css --output ../../themes/marx.css
 npx csso --input cleanrmd/inst/resources/minicss/minicss.css --output ../../themes/mini.css
 npx csso --input cleanrmd/inst/resources/new.css/new.css --output ../../themes/new.css
@@ -45,3 +45,5 @@ npx csso --input cleanrmd/inst/resources/water-dark/water-dark.css --output ../.
 npx csso --input cleanrmd/inst/resources/writ/writ.css --output ../../themes/writ.css
 
 rm -rf cleanrmd/ node_modules/ package-lock.json
+
+node fix.js

+ 14 - 0
build/themes/fix.js

@@ -0,0 +1,14 @@
+
+var fs = require('fs')
+var path = require('path')
+var themes = path.resolve(__dirname, '../../themes/')
+
+var css = fs.readFileSync(path.resolve(themes, 'mini.css'), 'utf8')
+
+fs.writeFileSync(
+  path.resolve(themes, 'mini.css'),
+  css
+    .replace('*,h5', 'body')
+    .replace('*,html', 'body'),
+  'utf8'
+)

+ 159 - 22
content/index.css

@@ -79,13 +79,21 @@ pre#_markdown {
   .markdown-theme { width: 1400px !important; }
 }
 
-._width-full {
+._width-full,
+._width-wide,
+._width-large,
+._width-medium,
+._width-small,
+._width-tiny {
   box-sizing: border-box;
-  width: 100% !important;
-  max-width: 100% !important;
-  min-width: 100% !important;
-  border: none;
+  border: none !important;
   padding: 20px !important;
+  min-width: auto !important;
+  max-width: none !important;
+}
+
+._width-full {
+  width: 100% !important;
   margin: 0 !important;
 }
 ._width-wide {
@@ -153,18 +161,25 @@ body._toc-right { padding-right: 300px !important; }
 }
 
 /*light*/
+._theme-air #_toc,
 ._theme-almond #_toc,
 ._theme-awsm #_toc,
 ._theme-axist #_toc,
 ._theme-bullframe #_toc,
 ._theme-kacit #_toc,
 ._theme-latex #_toc,
+._theme-marx #_toc,
 ._theme-mini #_toc,
+._theme-modest #_toc,
 ._theme-sakura #_toc,
+._theme-semantic #_toc,
+._theme-splendor #_toc,
 ._theme-style-sans #_toc,
 ._theme-style-serif #_toc,
+._theme-stylize #_toc,
 ._theme-tacit #_toc,
-._theme-water #_toc {
+._theme-water #_toc,
+._theme-writ #_toc {
   border-right: 1px solid #e1e4e8;
 }
 
@@ -246,48 +261,69 @@ body._toc-right { padding-right: 300px !important; }
 }
 
 /*light*/
+._theme-air::-webkit-scrollbar-track, ._theme-air *::-webkit-scrollbar-track,
 ._theme-almond::-webkit-scrollbar-track, ._theme-almond *::-webkit-scrollbar-track,
 ._theme-awsm::-webkit-scrollbar-track, ._theme-awsm *::-webkit-scrollbar-track,
 ._theme-axist::-webkit-scrollbar-track, ._theme-axist *::-webkit-scrollbar-track,
 ._theme-bullframe::-webkit-scrollbar-track, ._theme-bullframe *::-webkit-scrollbar-track,
 ._theme-kacit::-webkit-scrollbar-track, ._theme-kacit *::-webkit-scrollbar-track,
 ._theme-latex::-webkit-scrollbar-track, ._theme-latex *::-webkit-scrollbar-track,
+._theme-marx::-webkit-scrollbar-track, ._theme-marx *::-webkit-scrollbar-track,
 ._theme-mini::-webkit-scrollbar-track, ._theme-mini *::-webkit-scrollbar-track,
+._theme-modest::-webkit-scrollbar-track, ._theme-modest *::-webkit-scrollbar-track,
 ._theme-sakura::-webkit-scrollbar-track, ._theme-sakura *::-webkit-scrollbar-track,
+._theme-semantic::-webkit-scrollbar-track, ._theme-semantic *::-webkit-scrollbar-track,
+._theme-splendor::-webkit-scrollbar-track, ._theme-splendor *::-webkit-scrollbar-track,
 ._theme-style-sans::-webkit-scrollbar-track, ._theme-style-sans *::-webkit-scrollbar-track,
 ._theme-style-serif::-webkit-scrollbar-track, ._theme-style-serif *::-webkit-scrollbar-track,
+._theme-stylize::-webkit-scrollbar-track, ._theme-stylize *::-webkit-scrollbar-track,
 ._theme-tacit::-webkit-scrollbar-track, ._theme-tacit *::-webkit-scrollbar-track,
-._theme-water::-webkit-scrollbar-track, ._theme-water *::-webkit-scrollbar-track
+._theme-water::-webkit-scrollbar-track, ._theme-water *::-webkit-scrollbar-track,
+._theme-writ::-webkit-scrollbar-track, ._theme-writ *::-webkit-scrollbar-track
 {
   background: #efefef;
 }
+._theme-air::-webkit-scrollbar-thumb, ._theme-air *::-webkit-scrollbar-thumb,
 ._theme-almond::-webkit-scrollbar-thumb, ._theme-almond *::-webkit-scrollbar-thumb,
 ._theme-awsm::-webkit-scrollbar-thumb, ._theme-awsm *::-webkit-scrollbar-thumb,
 ._theme-axist::-webkit-scrollbar-thumb, ._theme-axist *::-webkit-scrollbar-thumb,
 ._theme-bullframe::-webkit-scrollbar-thumb, ._theme-bullframe *::-webkit-scrollbar-thumb,
 ._theme-kacit::-webkit-scrollbar-thumb, ._theme-kacit *::-webkit-scrollbar-thumb,
 ._theme-latex::-webkit-scrollbar-thumb, ._theme-latex *::-webkit-scrollbar-thumb,
+._theme-marx::-webkit-scrollbar-thumb, ._theme-marx *::-webkit-scrollbar-thumb,
 ._theme-mini::-webkit-scrollbar-thumb, ._theme-mini *::-webkit-scrollbar-thumb,
+._theme-modest::-webkit-scrollbar-thumb, ._theme-modest *::-webkit-scrollbar-thumb,
 ._theme-sakura::-webkit-scrollbar-thumb, ._theme-sakura *::-webkit-scrollbar-thumb,
+._theme-semantic::-webkit-scrollbar-thumb, ._theme-semantic *::-webkit-scrollbar-thumb,
+._theme-splendor::-webkit-scrollbar-thumb, ._theme-splendor *::-webkit-scrollbar-thumb,
 ._theme-style-sans::-webkit-scrollbar-thumb, ._theme-style-sans *::-webkit-scrollbar-thumb,
 ._theme-style-serif::-webkit-scrollbar-thumb, ._theme-style-serif *::-webkit-scrollbar-thumb,
+._theme-stylize::-webkit-scrollbar-thumb, ._theme-stylize *::-webkit-scrollbar-thumb,
 ._theme-tacit::-webkit-scrollbar-thumb, ._theme-tacit *::-webkit-scrollbar-thumb,
-._theme-water::-webkit-scrollbar-thumb, ._theme-water *::-webkit-scrollbar-thumb
+._theme-water::-webkit-scrollbar-thumb, ._theme-water *::-webkit-scrollbar-thumb,
+._theme-writ::-webkit-scrollbar-thumb, ._theme-writ *::-webkit-scrollbar-thumb
 {
   background: #d5d5d5;
 }
+._theme-air::-webkit-scrollbar-thumb:hover, ._theme-air *::-webkit-scrollbar-thumb:hover,
 ._theme-almond::-webkit-scrollbar-thumb:hover, ._theme-almond *::-webkit-scrollbar-thumb:hover,
 ._theme-awsm::-webkit-scrollbar-thumb:hover, ._theme-awsm *::-webkit-scrollbar-thumb:hover,
 ._theme-axist::-webkit-scrollbar-thumb:hover, ._theme-axist *::-webkit-scrollbar-thumb:hover,
 ._theme-bullframe::-webkit-scrollbar-thumb:hover, ._theme-bullframe *::-webkit-scrollbar-thumb:hover,
 ._theme-kacit::-webkit-scrollbar-thumb:hover, ._theme-kacit *::-webkit-scrollbar-thumb:hover,
 ._theme-latex::-webkit-scrollbar-thumb:hover, ._theme-latex *::-webkit-scrollbar-thumb:hover,
+._theme-marx::-webkit-scrollbar-thumb:hover, ._theme-marx *::-webkit-scrollbar-thumb:hover,
 ._theme-mini::-webkit-scrollbar-thumb:hover, ._theme-mini *::-webkit-scrollbar-thumb:hover,
+._theme-modest::-webkit-scrollbar-thumb:hover, ._theme-modest *::-webkit-scrollbar-thumb:hover,
 ._theme-sakura::-webkit-scrollbar-thumb:hover, ._theme-sakura *::-webkit-scrollbar-thumb:hover,
+._theme-semantic::-webkit-scrollbar-thumb:hover, ._theme-semantic *::-webkit-scrollbar-thumb:hover,
+._theme-splendor::-webkit-scrollbar-thumb:hover, ._theme-semantic *::-webkit-scrollbar-thumb:hover,
 ._theme-style-sans::-webkit-scrollbar-thumb:hover, ._theme-style-sans *::-webkit-scrollbar-thumb:hover,
 ._theme-style-serif::-webkit-scrollbar-thumb:hover, ._theme-style-serif *::-webkit-scrollbar-thumb:hover,
+._theme-stylize::-webkit-scrollbar-thumb:hover, ._theme-stylize *::-webkit-scrollbar-thumb:hover,
 ._theme-tacit::-webkit-scrollbar-thumb:hover, ._theme-tacit *::-webkit-scrollbar-thumb:hover,
-._theme-water::-webkit-scrollbar-thumb:hover, ._theme-water *::-webkit-scrollbar-thumb:hover
+._theme-water::-webkit-scrollbar-thumb:hover, ._theme-water *::-webkit-scrollbar-thumb:hover,
+._theme-writ::-webkit-scrollbar-thumb:hover, ._theme-writ *::-webkit-scrollbar-thumb:hover
 {
   background: #c4c4c4;
 }
@@ -431,20 +467,20 @@ body._toc-right { padding-right: 300px !important; }
 ._theme-sakura .octicon,
 ._theme-sakura-vader .octicon,
 ._theme-semantic .octicon,
-._theme-simplecss .octicon,
+._theme-simple .octicon,
 ._theme-stylize .octicon,
 ._theme-superstylin .octicon {
   line-height: 1px;
 }
-._theme-markdown-splendor .anchor,
-._theme-markdown-splendor .octicon {
+._theme-splendor .anchor,
+._theme-splendor .octicon {
   padding: 0 !important;
   margin: 0 0 0 -10px !important;
 }
-._theme-markdown-splendor h3 .octicon,
-._theme-markdown-splendor h4 .octicon,
-._theme-markdown-splendor h5 .octicon,
-._theme-markdown-splendor h6 .octicon
+._theme-splendor h3 .octicon,
+._theme-splendor h4 .octicon,
+._theme-splendor h5 .octicon,
+._theme-splendor h6 .octicon
 {
   position: relative;
   top: 4px;
@@ -476,16 +512,119 @@ body._toc-right { padding-right: 300px !important; }
   top: 10px;
 }
 
+/*---------------------------------------------------------------------------*/
+/*task list checkboxes*/
+
+._theme-awsm input[type=checkbox],
+._theme-kacit input[type=checkbox],
+._theme-no-class input[type=checkbox],
+._theme-semantic input[type=checkbox],
+._theme-tacit input[type=checkbox],
+._theme-vanilla input[type=checkbox] {
+  display: inline-block !important;
+  box-sizing: border-box !important;
+  padding: 0 !important;
+  margin: 0 !important;
+}
+._theme-bullframe input[type=checkbox],
+._theme-superstylin input[type=checkbox] {
+  position: relative;
+  top: 3px;
+}
+._theme-mini input[type=checkbox] {
+  position: relative;
+  top: 4px;
+}
+._theme-no-class input[type=checkbox] {
+  width: auto !important;
+}
+._theme-vanilla input[type=checkbox] {
+  appearance: auto !important;
+}
+
+/*---------------------------------------------------------------------------*/
+/*fix auto dark*/
+
+/*set default background color*/
+._theme-air,
+._theme-marx,
+._theme-modest,
+._theme-splendor,
+._theme-stylize,
+._theme-writ {
+  background-color: #fff;
+}
+
+/*set default text and link color*/
+._theme-semantic { color: #000; }
+._theme-semantic a { color: #0000ff; }
+._theme-semantic a:visited { color: #800080; }
+._theme-semantic a:active { color: #ff0000; }
+
 /*---------------------------------------------------------------------------*/
 /*theme fixes*/
 
 /*github-dark*/
 ._theme-github-dark {
-  background-color:#0d1117;
+  background-color: #0d1117;
 }
 ._theme-github-dark .markdown-body {
   border: 1px solid #30363d;
 }
+._theme-github-dark #_markdown {
+  background-color: #fff;
+}
+
+/*markdown-air - fix images*/
+._theme-air img {
+  border-radius: 0;
+  width: auto;
+  height: auto;
+}
+
+/*axist - fix lists*/
+._theme-axist ul li p {
+  display: inline-block;
+}
+/*axist - fix fenced code blocks*/
+._theme-axist pre::after {
+  content: none;
+}
+
+/*kacit, tacit - fix mermaid diagrams size*/
+._theme-kacit pre code,
+._theme-tacit pre code {
+  display: block;
+}
+
+/*mini - fix table*/
+._theme-mini table {
+  overflow-x: clip !important;
+  max-height: none !important;
+}
+/*mini - fix special symbols*/
+._theme-mini blockquote::before {
+  content: "“";
+}
+._theme-mini [type=checkbox]:checked:before {
+  content: "✓";
+  top: -3px;
+}
+
+/*simple - fix body width*/
+._theme-simple {
+  display: block;
+}
+
+/*style-sans, style-serif - fix inline code*/
+._theme-style-sans *:not(pre) > code::before,
+._theme-style-sans *:not(pre) > code::after,
+._theme-style-serif *:not(pre) > code::before,
+._theme-style-serif *:not(pre) > code::after {
+  content: '';
+  padding-left: 5px;
+  padding-right: 5px;
+}
 
 /*superstylin - fix lists*/
 ._theme-superstylin ul ul,
@@ -498,11 +637,9 @@ body._toc-right { padding-right: 300px !important; }
   margin-bottom: 0;
 }
 
-/*markdown-air - fix images*/
-._theme-markdown-air img {
-  border-radius: 0;
-  width: auto;
-  height: auto;
+/*vanilla - fix pre margin*/
+._theme-vanilla pre {
+  margin-bottom: 10px;
 }
 
 /*---------------------------------------------------------------------------*/

+ 7 - 7
content/index.js

@@ -19,7 +19,7 @@ var state = {
     'github': 'auto',
     'github-dark': 'dark',
     'almond': 'light',
-    'air': 'auto',
+    // 'air': 'light',
     'awsm': 'light',
     'axist': 'light',
     'bamboo': 'auto',
@@ -27,27 +27,27 @@ var state = {
     'holiday': 'auto',
     'kacit': 'light',
     'latex': 'light',
-    'marx': 'auto',
+    'marx': 'light',
     'mini': 'light',
-    'modest': 'auto',
+    'modest': 'light',
     'new': 'auto',
     'no-class': 'auto',
     'pico': 'auto',
     'retro': 'dark',
     'sakura': 'light',
     'sakura-vader': 'dark',
-    'semantic': 'auto',
+    'semantic': 'light',
     'simple': 'auto',
-    'splendor': 'auto',
+    // 'splendor': 'light',
     'style-sans': 'light',
     'style-serif': 'light',
-    'stylize': 'auto',
+    'stylize': 'light',
     'superstylin': 'auto',
     'tacit': 'light',
     'vanilla': 'auto',
     'water': 'light',
     'water-dark': 'dark',
-    'writ': 'auto',
+    'writ': 'light',
   }
 }
 

+ 2 - 10
popup/index.js

@@ -8,7 +8,7 @@ var state = {
   _themes: [
     'github',
     'github-dark',
-    'air',
+    // 'air',
     'almond',
     'awsm',
     'axist',
@@ -28,7 +28,7 @@ var state = {
     'sakura-vader',
     'semantic',
     'simple',
-    'splendor',
+    // 'splendor',
     'style-sans',
     'style-serif',
     'stylize',
@@ -116,13 +116,6 @@ var events = {
       message: 'popup.theme',
       theme: state.theme
     })
-    if (/^github/.test(state.theme) && !['auto', 'full'].includes(state.themes.width)) {
-      state.themes.width = 'auto'
-      chrome.runtime.sendMessage({
-        message: 'popup.themes',
-        themes: state.themes,
-      })
-    }
   },
 
   raw: () => {
@@ -236,7 +229,6 @@ m.mount(document.querySelector('body'), {
             state._width.map((width) =>
               m('option', {
                 selected: state.themes.width === width,
-                disabled: /^github/.test(state.theme) && !['auto', 'full'].includes(width) ? 'disabled' : null
               }, width)
             )
           ),