在github上降价的删除线代码 [英] strikethrough code in markdown on github
问题描述
我在这里讨论 github markdown ,对于像 README.md
这样的文件。
是否可以通过github上的markdown删除完整的代码块?
我知道如何标记文本作为一段代码
这是
多行代码
和
this
此
也
通过4个空格或使用```或`...
缩进我也知道如何<使用
临时解决方案
:独立地,它们工作正常,但并非如预期或期望的那样。我尝试了上面提到的几种组合。
现在,我使用这个:
striked
through
通过对每一行使用~~和`。
要求
strong>:我想要一个代码格式化的文本,其中代码块是连续的:
不幸的是,这是
没有穿过
或者至少只有一小段:
这完全有可能吗? 我发现了一些旧帖子和关于使用jekyll的提示,但我正在寻找的是一个简单的方法,最好是在降价。 这只适用于原始HTML, GitHub不允许。但你也许可以使用diff。 我意识到格式不会使用透视,但会使用常用和理解的格式。对于更复杂的块,您应该使用 I am talking about github markdown here, for files like Question:
Is it possible to strikethrough a complete code block in markdown on github? I know how to mark text as a block of code by indenting by 4 spaces or by using ``` or `... I also know how to Temporary solution: Independently they work fine, but together not as expected or desired. I tried several combinations of the above mentioned. For now, I use this: by using ~~ and ` for every single line. Requirement: I would like to have a code formatted text striked through, where the code block is continuous: or at least with only a small paragraph in between: Is this possible at all? I found some old posts and hints on using jekyll, but what I was searching for is a simple way, preferably in markdown. This would only be possible with raw HTML, which GitHub doesn't allow. But you may be able to use a diff instead. Code blocks are for "pre-formatted" text only. The only formatting you can get in a code block is the formatting that can be represented in plain text (indentation, capitalization, etc). There is no mechanism to mark up the content of a code block (as bold, italic, stricken, underlined, etc). This was an intentional design decision. Otherwise, how would you be able to show Markdown text in a code block? If you want formatted text, then you need to use something other than a code block. As the rules state: HTML is a publishing format; Markdown is a writing format. Thus, Markdown’s formatting syntax only addresses issues that can be conveyed in plain text. For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. Therefore you would need to format your own custom HTML code block with the various bits marked up properly: However, for security reasons, GitHub will strip out any such raw HTML in your Markdown. So while this works where you have full control of the entire stack, on a hosted service it is most likely not possible. However, I'm assuming you want to show some changes made to a block of code. As it turns out, a specific format already exists for that. Namely a diff. Just use a fenced code block with You can see how GitHub displays the above code block live (you can also see that in raw), but I've included a screenshot below for convenience. I realize that the formatting does not use strike-through, but is does use a commonly used and understood format. For more complex blocks, you should probably use the 这篇关于在github上降价的删除线代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!不幸的是,也没有通过
$敲入
diff
实用程序为您生成差异。README.md
.this is
multiline code
and
this
this
also
strike through texts using
striked
through
unfortunately, this is
not striked through
unfortunately, also not
striked through
<pre><code><del>some stricken code</del>
<del>A second line of stricken code</del>
</pre></code>
diff
as the language and GitHub will format it correctly:```diff
Unchanged Line
- Removed Line
+ Added Line
```
diff
utility program to generate the diff for you.