Python烧瓶以及如何在网页中显示代码 [英] Python flask and how to show code in a web page
问题描述
我想创建一个页面的一部分,它将显示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屋!