如何在GitHub的README.md中将图像居中? [英] How do I center an image in the README.md on GitHub?

查看:310
本文介绍了如何在GitHub的README.md中将图像居中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在查看GitHub中使用的MarkDown语法一段时间,但除了将图像调整为 README.md 页面的宽度外,我不知道如何居中放置图片.

I've been looking at the MarkDown syntax used in GitHub for a while but except resizing an image to the width of the README.md page, I can't figure out how to center an image in it.

这可能吗?如果是这样,我该怎么办?

Is this possible? If so, how can I do it?

推荐答案

我一直在查看github [...]中使用的markdown语法,我不知道如何将图像居中

I've been looking at the markdown syntax used in github [...], I can't figure out how to center an image

TL; DR

否,您只能依靠Markdown语法.Markdown不在乎位置.

No you can't by only relying on Markdown syntax. Markdown doesn't care with positioning.

注意:某些降价处理器支持HTML的包含(如@ waldyr.ar正确指出的那样),在GitHub情况下,您可能会回退到类似< div style ="text-align:center">< img src ="..."/></div> .请注意,如果您的存储库是在其他托管环境(Codeplex,BitBucket等)中创建的,或者无法通过浏览器读取文档(Sublime Text Markdown预览,MarkdownPad,VisualStudio Web),则不能保证图像居中Essentials Markdown预览,...).

Note: Some markdown processors support inclusion of HTML (as rightfully pointed out by @waldyr.ar), and in the GitHub case you may fallback to something like <div style="text-align:center"><img src="..." /></div>. Beware that there's no guarantee the image will be centered if your repository is forked in a different hosting environment (Codeplex, BitBucket, ...) or if the document isn't read through a browser (Sublime Text Markdown preview, MarkdownPad, VisualStudio Web Essentials Markdown preview, ...).

注释2:请记住,即使在GitHub网站中,降价的呈现方式也不是统一的.例如,Wiki不允许此类CSS位置欺骗.

Note 2: Keep in mind that even within the GitHub website, the way markdown is rendered is not uniform. The wiki, for instance, won't allow such css positional trickery.

未删节的版本

Markdown语法 并没有提供该功能来控制图像的位置.

The Markdown syntax doesn't provide one with the ability to control the position of an image.

事实上,如 部分

In fact, it would be borderline against the Markdown philosophy to allow such formatting, as stated in the "Philosophy" section

"Markdown格式的文档应以纯文本形式原样发布,而不会看起来像被标签或格式说明所标记."

"A Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions. "

Markdown 文件由 github.com 网站通过使用 Ruby Redcarpet 库.

Markdown files are rendered by github.com website through the use of the Ruby Redcarpet library.

Redcarpet公开了一些 扩展名 (例如删除线),它们不是标准Markdown语法的一部分,并提供其他功能".但是,没有受支持的扩展程序允许您将图像居中.

Redcarpet exposes some extensions (such as strikethrough, for instance) which are not part of standard Markdown syntax and provide additional "features". However, no supported extension allow you to center an image.

这篇关于如何在GitHub的README.md中将图像居中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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