【问题标题】:why doesn't CSS file work in readthedocs?为什么 CSS 文件在 readthedocs 中不起作用?
【发布时间】:2021-09-27 13:04:22
【问题描述】:

我在readthedocs 网站上有我的应用程序的文档。我有一个.css 文件,它改变了侧边栏的外观。大约三个月前,这个.css 文件运行良好,但现在不行了。这是link。
这就是它的样子:

这就是现在的样子:

.css 文件:

/* Fixes the size of the RTD flyout */
/* .rst-versions {
    width: 320px !important;
} */

/* Content area color */
.wy-nav-content {
    background: #dddddd;
}

/* Scroll Bar*/
.wy-side-scroll {
    width: auto;
    overflow-y: auto;
    margin-top: 0px;
}

/* width of the side panel */
.wy-nav-side {
    width: 320px;
}

/* content section full screen */
.wy-nav-content {
   max-width: none; 
}

/* set color of left side bar */
.wy-nav-side,.wy-side-nav-search,.wy-nav-top {
    /*background: #0079c1; /*005eb8 */
   background: #006464;
}

/* Change caption color to be more legible */
.wy-menu > .caption > span.caption-text {
   color: #ffcccc;
   font-size: 20px;
}

/* Change the version color to match caption color */
.wy-side-nav-search>div.version {
   color: #ffcccc;
}

/* Get rid of that ugly yellow highlight color and replace with something more appealing to the eye */
.highlight .hll {
   background-color: #fcfcfc;
}
/* 
@media screen and (max-width: 768px) {
    .wy-nav-content-wrap {
        margin-left: 0px;
    }
    .wy-nav-side {
        width: 500px;
    }
} */

这可能是什么原因?谢谢!

【问题讨论】:

  • sphinx_rtd_theme 的 1.0 版于 2021 年 9 月 13 日发布。 HTML 标记、CSS 或 JS 可能已更改,您需要相应地调整自定义样式表。

标签: css documentation read-the-docs


【解决方案1】:

我部分确认@Steve Piercy 在评论中所说的话。规则.wy-menu > .caption > span.caption-text { 不再起作用,因为围绕<span class="caption-text"> 的<p> 不再具有caption 类。您可以通过比较 latest 和 1.3.4-branch 来检查。

但是,正如您从构建日志(old、new)中看到的那样,问题不在于sphinx-rtd-theme(您在两者中都使用了 0.5.0),而是docutils 版本(0.16在旧版本中,在新版本中为 0.17)。您将需要升级您的 Sphinx 版本,或降级 docutils。

【讨论】:

  • 非常感谢您的回答!所以我只是更改了requirements.txt 文件并在那里添加了docutils==0.16 行,现在一切正常!
猜你喜欢
  • 2013-10-22
  • 1970-01-01
  • 2020-10-13
  • 2019-12-08
  • 2015-09-30
  • 2011-11-21
  • 2018-02-01
  • 1970-01-01
  • 2020-04-14
相关资源
最近更新 更多