Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python flatpages中隔离代码块的语法突出显示_Python_Html_Css_Flask_Pygments - Fatal编程技术网

Python flatpages中隔离代码块的语法突出显示

Python flatpages中隔离代码块的语法突出显示,python,html,css,flask,pygments,Python,Html,Css,Flask,Pygments,我正在尝试使用FlackPages来呈现我的降价帖子。标记扩展是,所以我为FLATPAGES设置FLATPAGES\u标记扩展=['fenced\u code']。我还想使用pygmentscss突出显示我的代码。创建css视图: @app.route('/pygments.css') def pygments_css(): return pygments_style_defs('tango'), 200, {'Content-Type':"text/css"} Jinja2模板htm

我正在尝试使用FlackPages来呈现我的降价帖子。标记扩展是,所以我为FLATPAGES设置
FLATPAGES\u标记扩展=['fenced\u code']
。我还想使用
pygments
css突出显示我的代码。创建css视图:

@app.route('/pygments.css')
def pygments_css():
    return pygments_style_defs('tango'), 200, {'Content-Type':"text/css"}
Jinja2模板html如下所示:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="{{ url_for('pygments_css')  }}">
  </head>
    {{ post.html|safe}}
  <body>

  </body>
</html>
为了突出显示fenced代码块呈现的html,我应该使用fenced代码块样式的css。是否仍要获取受保护的代码块hightlight css文件

# part of pygments.css
.codehilite .hll { background-color: #ffffcc }
.codehilite  { background: #f8f8f8; }
.codehilite .c { color: #8f5902; font-style: italic } /* Comment */
.codehilite .err { color: #a40000; border: 1px solid #ef2929 } /* Error */
.codehilite .g { color: #000000 } /* Generic */
.codehilite .k { color: #204a87; font-weight: bold } /* Keyword */
.codehilite .l { color: #000000 } /* Literal */
.codehilite .n { color: #000000 } /* Name */
.codehilite .o { color: #ce5c00; font-weight: bold } /* Operator */
.codehilite .x { color: #000000 } /* Other */