sphinx插入css
使用role指令达到目的。
We can put following lines at the beginning of our RST file to specify its style.
.. raw:: html
<style>.red {color:red}</style>
然后使用role指令:
.. role:: red
:class: red
调用role指令:
This is an :red:`inline text`.
which translates into a html rendering of
.. This is an <span class="red">inline text</span>. ..
如何分离css:
I found the other answers very helpful. I am not very familiar with Sphinx but I am using it for a project. I too wanted the strike-through ability and have got it working based on the previous answers. To be clear, I added my strikethrough role as gozzilli mentioned but I saved it inside my conf.py using the rst_prolog variable as discussed in the stack overflow thread here. This means that this role is available to all of your rest files.
I then extended the base html template as described above by creating layout.html
within _templates
inside my source directory. The contents of this file are:
{% extends "!layout.html" %}
{% set css_files = css_files + ["_static/myStyle.css"] %}
This basically includes a custom css file to all your built default html docs.
Finally, in my _static directory within my source directory I included the file myStyle.css
which contains:
.strike {
text-decoration: line-through;
}
Which the other answers have already provided.
I am merely writing this answer as it wasn't obvious to me with my limited Sphinx experience which files to edit.
参考了:
http://stackoverflow.com/questions/6518788/rest-strikethrough
http://stackoverflow.com/questions/4669689/how-to-use-color-in-text-with-restructured-text-rst2html-py-or-how-to-insert-h
http://stackoverflow.com/questions/9698702/custom-css-styles-in-sphinx
sphinx插入css的更多相关文章
- JavaScript 动态插入 CSS
写组件时有时想把一些组件特性相关的 CSS 样式封装在 JS 里,这样更内聚,改起来方便.JS 动态插入 CSS 两个步骤就可以 创建一个 style 对象 使用 stylesheet 的 inser ...
- html中插入css和js
插入css: HTML周明华添加css样式的方法有很多种,常见的有一下几种:. 1.直接标签后添加如: <html> <div style="background:red; ...
- 在网页中插入CSS样式表的几种方法
1. 链入外部样式表 链入外部样式表是把样式表保存为一个样式表文件,然后在页面中用<link>标记链接到这个样式表文件,这个<link>标记必须放到页面的<head> ...
- sphinx插入代码
示例的Python源代码或者交互界面都可以使用标准reST模块实现.在正常段落后面跟着 :: 开始,再加上适当缩进. 交互界面需包含提示及Python代码的输出. 交互界面没有特别的标记. 在最后一行 ...
- Js 动态插入css js文件
function loadjscssfile(filename,filetype){ var file, //动态插入的文件 doc = document; if(filetype == " ...
- HTML页面中插入CSS样式的三种方法
1. 外部样式 当样式需要应用于很多页面时,外部样式表将是理想的选择.在使用外部样式表的情况下,你可以通过改变一个文件来改变整个站点的外观.每个页面使用<link>标签链接到样式表. &l ...
- 巧用函数实现js插入css样式
我用的是webstorm,当写css 样式时候,会没有提示,可以按Ctrl+Alt+Space.
- 插入CSS的方法
传送门 选择器 selector {declaration1; declaration2; ... declarationN } 例: p { text-aligh:center; } ...
- 插入css样式表的三种方法
http://www.w3school.com.cn/css/css_howto.asp http://www.runoob.com/css/css-howto.html 当读到一个样式表时,浏览器会 ...
随机推荐
- 通过SSHFS在RHEL中安全的挂载远程Linux/UNIX目录或文件系统--转载
You can easily mount remote server file system or your own home directory using special sshfs and fu ...
- 浏览器中JavaScript执行原理
本章我们讨论javascript在浏览器中是如果工作的,包括:下载.解析.执行的全过程.javascript的这些讨人嫌的地方我们是知道的: i.需要串行下载 ii.需要解析 iii.需要串行执行 而 ...
- eclipse4.3 kepler中安装maven
1.软件准备 a:Eclipse 4.3 http://www.eclipse.org/downloads/ b:maven http://maven.apache.org/download.cgi ...
- Python之路【第十三篇】:jQuery -暂无内容-待更新
Python之路[第十三篇]:jQuery -暂无内容-待更新
- Java使用poi对Execl简单操作_总结
poi是Apache组织给开发者提供一套操作office(Execl,Word,PowerPoint)等Java API,开发者通过Poi API可以快速的操作office办公软件,以上3篇博文只是一 ...
- Css3渐变实例Demo(一)
1.指定渐变背景的大小 .div { background: url(../img/1.jpg); /*background-size:contain;*/ width: 500px; height: ...
- angularjs kindEditor 中content获得不到值
angularjs kindEditor 中content获得不到值 需要修改下angular-kindeditor.js angular-kindeditor.js if (KindEditor) ...
- js获取标签的几种方式
一:id获取(全部浏览器兼容) document.getElementById(""); <body> <div id="box">&l ...
- Python:标准数据类型6种
#!/usr/bin/python3 #python的基本语法和数据类型 #python3中 一行有多个语句,用分号分割(;) print("aaa") ;print(" ...
- 【清澄A1333】【整体二分+二维树状数组】矩阵乘法(梁盾)
试题来源 2012中国国家集训队命题答辩 问题描述 给你一个N*N的矩阵,不用算矩阵乘法,但是每次询问一个子矩形的第K小数. 输入格式 第一行两个数N,Q,表示矩阵大小和询问组数: 接下来N行N列一共 ...