Markdown

Best practice for allowing Markdown in Python, while preventing XSS attacks?

邮差的信 提交于 2021-02-05 13:07:32
问题 I need to let users enter Markdown content to my web app, which has a Python back end. I don’t want to needlessly restrict their entries (e.g. by not allowing any HTML, which goes against the spirit and spec of Markdown), but obviously I need to prevent cross-site scripting (XSS) attacks. I can’t be the first one with this problem, but didn’t see any SO questions with all the keywords “python,” “Markdown,” and “XSS”, so here goes. What’s a best-practice way to process Markdown and prevent XSS

Best practice for allowing Markdown in Python, while preventing XSS attacks?

♀尐吖头ヾ 提交于 2021-02-05 13:06:28
问题 I need to let users enter Markdown content to my web app, which has a Python back end. I don’t want to needlessly restrict their entries (e.g. by not allowing any HTML, which goes against the spirit and spec of Markdown), but obviously I need to prevent cross-site scripting (XSS) attacks. I can’t be the first one with this problem, but didn’t see any SO questions with all the keywords “python,” “Markdown,” and “XSS”, so here goes. What’s a best-practice way to process Markdown and prevent XSS

README is deformed in npmjs but appears in github

爷,独闯天下 提交于 2021-02-05 11:44:33
问题 The readme file is represented as a binary file in npmjs.com but not in github.com screeshot: Url to the package github: https://github.com/scicave/rakam npmjs: https://npmjs.com/package/rakam 回答1: Your README.md is encoded as little-endian UTF-16, with mixed line endings: $ file README.md README.md: Little-endian UTF-16 Unicode text, with very long lines, with CRLF, CR line terminators UTF-16 is fairly uncommon these days; UTF-8 has largely replaced it. Consider re-encoding your file as UTF

How can I highlight .gitignore code for my README.md?

只愿长相守 提交于 2021-02-05 11:14:36
问题 I wrote a README.md with parts of code and I want to highlight those parts with the right colors. One of this code is a .gitignore code , that I would like to integrate to my README.md . But I can't have the good linguist highlight for this, which colorize in green my comments for example. I have searched some languages detected by GFM but I am not satisfied by the results. Can someone help me to find the good linguist ? P.S. : I also want to question for a DockerFile, docker-compose in a

too much render with react markdown

旧巷老猫 提交于 2021-02-05 08:11:12
问题 I am using React Markdown (https://www.npmjs.com/package/react-markdown) to render markdown content in my NextJS project. When I refresh I have two "toto" & "titi" in my terminal... It is normal or what's wrong with this code? import Head from 'next/head'; import ReactMarkdown from 'react-markdown'; function Section ({ data }) { const content = JSON.parse(data.markdown); const { title, sortContent } = data; console.log('toto'); return ( <> <main> <h1>{title}</h1> <h1>{sortContent}</h1>

How to break a long headed line in markdown pandoc?

雨燕双飞 提交于 2021-02-04 21:19:26
问题 In this markdown code ## This a very long line header which was written in markdown I'd like to split the long line in 2 lines but maintaining the style of header. This is wrong intent: ## This a very long line header which was written in markdown result in: This a very long line header which was written in markdown The strategy to use 2 times ## doesn't work result (unnecesary break line): 回答1: There's a pandoc issue requesting exactly what you want, so currently it's unfortunately not

How to break a long headed line in markdown pandoc?

*爱你&永不变心* 提交于 2021-02-04 21:18:07
问题 In this markdown code ## This a very long line header which was written in markdown I'd like to split the long line in 2 lines but maintaining the style of header. This is wrong intent: ## This a very long line header which was written in markdown result in: This a very long line header which was written in markdown The strategy to use 2 times ## doesn't work result (unnecesary break line): 回答1: There's a pandoc issue requesting exactly what you want, so currently it's unfortunately not

How to create code snippet with tabs in Github?

可紊 提交于 2021-02-04 20:20:55
问题 How to create code snippet with tabs in Github, something like this:: 回答1: GitHub pages or GFM (GitHub Flavored Markdown) themselves does not have a feature for that kind of snippet code presentation. For GitHub pages, you would need to upload an HTML page, with the right CSS, n order to achive that kind of presentation. 来源: https://stackoverflow.com/questions/49973422/how-to-create-code-snippet-with-tabs-in-github

redmine 设置 markdown 格式文本后打开html标签,以便开启显示红色字体等功能

萝らか妹 提交于 2021-02-04 16:32:28
P:\Bitnami\redmine-4.1.1-7\apps\redmine\htdocs\lib\redmine\wiki_formatting\markdown\formatter.rb :filter_html => true, 改为: :filter_html => false, <p style="color:RED;font-size=40pt;background=green"> red TITLE 1</p> <font color="red"> red text </font> <font face="黑体">我是黑体字</font> <font face="微软雅黑">我是微软雅黑</font> <font face="STCAIYUN">我是华文彩云</font> <font color=#0099ff size=7 face="黑体">color=#0099ff size=72 face="黑体"</font> <font color=#00ffff size=72>color=#00ffff</font> <font color=gray size=72>color=gray</font> 来源: oschina 链接: https://my.oschina.net/SamXIAO/blog/4945331

使用 Joplin 更快地找到你的笔记

天涯浪子 提交于 2021-02-04 09:30:30
在多个手写和数字平台上整理笔记是一个严峻的挑战。这里有一个小技巧,可以更好地组织你的笔记,并快速找到你需要的东西。 在前几年,这个年度系列涵盖了单个的应用。今年,我们除了关注 2021 年的策略外,还将关注一体化解决方案。欢迎来到 2021 年 21 天生产力的第十五天。 保持生产力也意味着(在某种程度上)要有足够的组织能力,以便找到笔记并在需要时参考它们。这不仅是对我自己的挑战,也是与我交谈的很多人的挑战。 多年来,我在应用中单独或使用数字笔记、纸质笔记、便签、数字便签、Word 文档、纯文本文件以及一堆我忘记的其他格式的组合。这不仅让寻找笔记变得困难,而且知道把它们放在哪里是一个更大的挑战。 一堆笔记 (Jessica Cherry, CC BY-SA 4.0 ) 还有就是做笔记最重要的一点:如果你以后找不到它,笔记就没有任何价值。知道含有你所需信息的笔记存在于你保存笔记的 某处 ,根本没有任何帮助。 我是如何为自己解决这个问题的呢?正如他们所说,这是一个过程,我希望这也是一个对其他人有效的过程。 我首先看了看自己所做的笔记种类。不同的主题需要用不同的方式保存吗?由于我为我的播客手写笔记,而几乎所有其他的东西都使用纯文本笔记,我需要两种不同的方式来维护它们。对于手写的笔记,我把它们都放在一个文件夹里,方便我参考。 三年多的笔记 (Kevin Sonney, CC BY-SA 4