Python烧瓶以及如何在网页中显示代码 [英] Python flask and how to show code in a web page

查看:126
本文介绍了Python烧瓶以及如何在网页中显示代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的web框架是Flask。

我想创建一个页面的一部分,它将显示java脚本和html代码片段。我不知道这样做的行话。有没有任何python瓶插件?还有其他类型的js库吗?再次,我需要js和html代码片段。



谢谢 解决方案

看看美化 - Stackoverflow使用它来格式化代码。它将在您的网页上格式化代码,并使其看起来像在这个网站上一样。



您只需在页面上添加JavaScript和CSS即可。

  < link rel =stylesheettype =text / csshref =css / colorschemes / prettify.css/> 
< script type =text / javascriptsrc =js / prettify / prettify.js>< / script>

请参阅设置说明这里


My web framework is Flask.

I would like to create a section of a page that will show java script and html code fragments. I dont know the lingo for doing this. Are there any python flask plugins for this? ANy other type of js libaries? Again, I need js and html code snippets.

Thanks

解决方案

Take a look at Prettify - Stackoverflow uses this to format code. It will format code on your page and make it look as it does here on this site.

You just include the JavaScript and CSS on your page.

<link rel="stylesheet" type="text/css"  href="css/colorschemes/prettify.css" />
<script type="text/javascript" src="js/prettify/prettify.js"></script>

See the setup instructions here

这篇关于Python烧瓶以及如何在网页中显示代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆