本文介绍了为什么GitHub不允许为.md文件中的文本着色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以最近我正在使用Azure DevOps进行项目,我真的很喜欢那里的Wiki.
但是一周前,对于一个大学项目,我不得不直接使用GitHub,在那里我意识到甚至连基本的格式化选项都丢失了.令我深受打击的缺失选项之一是我什至不能给文本加上颜色.

So recently i was using Azure DevOps for projects and i really liked the wiki there.
However a week ago for a University project i had to use GitHub directly, where i realized that even basic formatting options are missing. One of the missing option that hit me hard was that i can't even color texts.

在Azure DevOps中,您可以为文本着色:

In Azure DevOps you can color texts like this:

<font color="red">Please Note that this is a work in progress repository!</font>

在互联网上进行了一些搜索之后,我只发现了一半的解决方案,例如使用图片等.还有GitHub问题,这些问题在没有真正解释的情况下就已经关闭.

After a little bit of searching on the internet i only found half solutions like use a picture etc.., and GitHub issues that were closed without real explanations.

那么有人知道为什么GitHub不允许我们为文本着色吗?这背后有技术原因吗?

So does anyone know why GitHub does not allow us to color our texts? Is there a technical reason behind this?

推荐答案

通常,GitHub不允许对Wiki,自述文件和呈现的HTML中的文本进行大多数转换.有两个原因.

In general, GitHub doesn't allow most transformations on text in wikis, READMEs, and rendered HTML. There are a couple reasons for this.

一个,许多转换可能会导致页面区域溢出或其他可能欺骗内容的技术.这包括许多font标记和多种类型的CSS.由于欺骗或尝试修改其他页面内容是一个安全问题,因此不允许进行大多数这些UI调整.实际上,我怀疑GitHub会完全剥离font标签.

One, many transformations can allow overflowing regions of the page or other techniques that could possibly spoof content. This includes many font tags and many types of CSS. Because spoofing or attempting to modify other page content is a security issue, most of those UI tweaks are disallowed. I suspect, in fact, that GitHub strips font tags altogether for this reason.

二,GitHub希望该页面对所有用户都清晰易读.几乎每个用户都需要能够在具有各种字体大小的各种设备上阅读呈现的页面.即使您可以在白色上阅读浅灰色,许多人也不能阅读,并且由于可访问性原因,随意更改颜色也不是一个好主意.法律要求GitHub必须可访问.

Two, GitHub wants the page to be legible and readable for all users. Rendered pages need to be able to be read on a wide variety of devices, with a wide variety of font sizes, by pretty much every user. Even if you can read light grey on white, many people cannot, and for accessibility reasons, changing colors arbitrarily isn't a good idea. GitHub is required by law to be accessible.

第三,如果人们可以在不可读的页面上写内容(例如,白底白字),那么他们就会造成垃圾邮件和滥用问题.这意味着人们可以尝试托管链接到垃圾网站的内容,并将其隐藏起来,这得益于GitHub是受欢迎的网站这一事实.

Three, if people can write content in pages that is unreadable, say white on white, then they can create a spam and abuse problem. This means that people can try to host content that links to spammy sites and hide it from view, benefiting from the fact that GitHub is a popular site.

四,让人们改变样式和颜色会带来潜在的问题.即使您的样式因上述所有其他原因而没有问题,但是,如果GitHub要引入深色模式,那么让人们随意为其Wiki上色将可以防止这种情况的发生.

Four, letting people change styling and colors presents potential problems. Even if your styling were unproblematic for all of the other reasons above, if GitHub wanted to introduce a dark mode, then letting people arbitrarily color their wikis would prevent that from being a possibility.

这篇关于为什么GitHub不允许为.md文件中的文本着色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-01 03:14