fi3ework / hexo-theme-archer

🎯 A smart and modern theme for Hexo.
https://fi3ework.github.io/hexo-theme-archer
MIT License
1.5k stars 274 forks source link

markdown渲染的有序列表出现前导0 且 有序和无序列表的间距过小 #287

Closed diggid4ever closed 3 years ago

diggid4ever commented 3 years ago

作者您好!麻烦请教您两个问题 1.在渲染markdown时,有序列表会出现前导0,如何才能去掉呢?

2.并且无论有序列表还是无序列表,行与行的间距过小(相较于typora中的间距),感觉字比较挤 image 下面是typora中的间距 image

感谢回答!

secsilm commented 3 years ago

行间距的问题,需要重新 build 主题,参见 二次开发文档

LolipopJ commented 3 years ago

@diggid4ever 可以修改 src\scss\_partial\_post-page.scss 文件,设置样式表如下:

.abstract-content,
.article-entry {
  li {
    word-wrap: break-all;
    line-height: 1.625;
  }
  ul,
  ul li {
    list-style-type: initial;
    margin-top: .25em;
  }
  ol,
  ol li {
    list-style-type: decimal-leading-zero;
    margin-top: .25em;
  }
}

效果可以参考我的这篇博客

diggid4ever commented 3 years ago

谢谢帮助!有个问题,我按照这个修改了,从src\scss\_partial\_post-page.scss 文件的// ========== content ========== //注释处,下面的内容是:

.abstract-content,
.article-entry {
//  position: relative;
//  padding: 1px 0;
//  font-weight: lighter;
//  font-weight: 400;
//  color: $post-content-color;

  li {
    word-wrap: break-all;
    line-height: 1.625;
  }

  ul,
  ul li {
    list-style-type: initial;
    margin-top: .25em;
  }
  ol,
  ol li {
    list-style-type: decimal-leading-zero;
    margin-top: .25em

  }
  @for $i from 1 through 6 {
    h#{$i} {
      &:first-child {
        margin-top: 0;
      }
    }
  }
  @for $i from 2 through 4 {
    h#{$i} {
      // &::before {
      //     content: "#";
      //     margin-right: 2px;
      //     color: $feature-color;
      //     font: 1em $base-font-family;
      //     font-weight: bold;
      // }
    }
  }
  h1 {
  }
  h2 {
  }
  h3 {
  }
  h4 {
  }
  h5 {
    font-size: 1rem;
    margin: 1rem 0;
  }
  h6 {
    font-size: 0.8rem;
    margin: 1rem 0;
  }
  p {
    line-height: 1.625;
  }
  em {
    font-style: italic;
  }
  img {
    display: block;
    max-width: 100%;
    margin: 1rem auto 1rem;
    box-shadow: 0 0 4px 2px rgba(0, 0, 0, 0.2);
  }
  blockquote {
    margin: 1.5em 0 1.5rem 0;
    padding: 10px 20px;
    position: relative;
    background-color: #f6f6f6;
    border-left: 3px solid $feature-color;
    p {
      margin: 0;
    }
  }
  .table-container table,
  > table {
    width: 100%;
    border: 1px solid #ddd;
    margin: 1rem 0;
    border-collapse: collapse;
    box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.125);
    tr,
    td {
      height: 2rem;
    }
    thead {
      tr {
        background: #f8f8f8;
      }
    }
    tbody {
      tr:hover {
        background: #efefef;
      }
    }
    td,
    th {
      border: 1px solid #dedede;
      padding: 0.2rem 1rem 0 1rem;
    }
  }
  a {
    color: $feature-color;
    padding: 0 0 0 2px;
    word-break: break-all;
    &:hover {
      border-bottom: 1px solid $feature-color;
    }
    &.fancybox {
      border: 0;
    }
  }
}

我这样修改正确吗,修改完后我在archer目录下npm run build了一下,但是发现没有变化,是哪里出了问题呢

LolipopJ commented 3 years ago

~之前二次开发的时候我也遇到了类似的问题,似乎 npm run build 命令没有按预想中生成需要的 .css.js 文件,可能gulpfile.js 文件编写上的问题。可以试着使用 npm run dev 启用本地开发预览,这时应该可以生成打包好的文件了。~

  1. 在 Archer 主题目录下执行 npm run build
  2. 在 Hexo 根目录下执行 hexo generate 重新生成 Hexo 博客。

也可以在本地实时预览:

  1. 如果有,请首先删除 Hexo 根目录下的 public 文件夹。
  2. 在 Hexo 根目录下执行 hexo s 启动本地服务器。
  3. 在 Archer 主题目录下执行 npm run dev 进入本地开发模式。
  4. 使用浏览器打开 localhost:3000

近期将更新一下二次开发文档😃

diggid4ever commented 3 years ago

问一下你的gulp版本是多少,我npm run build之后爆出了一些问题,貌似和gulp的版本有关

gulp -v

CLI version: 2.3.0
Local version: 3.9.1
npm run build
hexo-theme-archer@1.5.0 build
gulp build --option

fs.js:45
} = primordials;
^

ReferenceError: primordials is not defined
at fs.js:45:5
at req_ (C:\Blog\themes\archer\node_modules\natives\index.js:143:24)
at Object.req [as require] (C:\Blog\themes\archer\node_modules\natives\index.js:55:10)
at Object. (C:\Blog\themes\archer\node_modules\vinyl-fs\node_modules\graceful-fs\fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)

十分感谢您耐心的帮助!!

LolipopJ commented 3 years ago

@diggid4ever 似乎是 gulp 版本和你的 Node.js 版本发生了冲突,参考这个问题

测试了一下,升级 gulp 版本会导致其它冲突,建议降低 Node.js 版本到 < 12。


还是不行的话可以使用我这边已经修改好的项目,替换原有的主题即可。

diggid4ever commented 3 years ago

太感谢您啦!我换了您的主题后成功了!nodejs的版本问题还是有点 您方便再发一下您的gulp版本和node版本吗 我想琢磨一下 以后也方便自己二次开发修改(还有个问题想问您,或许您知道行内代码的颜色是改哪个参数呢,我想把原先的灰色替换为红色)

LolipopJ commented 3 years ago

还有个问题想问您,或许您知道行内代码的颜色是改哪个参数呢,我想把原先的灰色替换为红色

code

看上去是在 src/scss/_partial/_post/_code.scss 中:

.abstract-content,
.article-entry {
  code {
    color: red; // 修改为您想要的颜色
  }
}

nodejs的版本问题还是有点 您方便再发一下您的gulp版本和node版本吗 我想琢磨一下 以后也方便自己二次开发修改

马上,我合并了 #285 提交请求,现在正在测试。😁

LolipopJ commented 3 years ago

目前使用的 Node.js 版本是 14.17.0,gulp 版本可以在 package.json 中查看,如下:

"devDependencies": {
  "gulp": "^4.0.2",
  "gulp-sass": "^4.1.0",
},
"dependencies": {
  "graceful-fs": "^4.2.6",
  "gulp-cli": "^2.3.0",
}
diggid4ever commented 3 years ago

好的 再次谢谢您 我大概知道其他的修改方向了 学到了!😁

LolipopJ commented 3 years ago

现在您可以尝试拉取此主题仓库的代码了,我已经把这些改动合并到主分支上去了。😁

如果引发了其它的问题,欢迎提出更多的 Issue 😉