質問

I have a README.md markdown file that I use to describe a project that is hosted on GitHub. Within this file I have several headlines and sub-headlines, each starting with one or more hashes, as usual in markdown.

Now I want to set the text of one headline to C#, but GitHub does not respect the hash a part of the text, but interprets it as an (optional) closing hash for the headline.

Even if I escape the hash by prefixing it with a backslash, it does not work. So if I type

## C#

I get:

C

If I use

## C\#

I get:

C\

How do I write this head-line in a correct way?

役に立ちましたか?

解決

Method 1

You could use a true sharp sign, , instead of the hash sign, #. From the Wikipedia page on C♯:

By convention, a hash sign is used for the second character in normal text; in artistic representations, sometimes a true sharp sign is used: C♯.

Here ## C♯ produces

C♯

Method 2

Alternatively, (at least on this site) just put a space after the last #, for example ## C\# produces

C#

Note that Pandoc seems to handle # C\# correctly (try it).

他のヒント

An alternative to try is adding another trailing # because they act like brackets on the line, so ## C# # or ## C# ## if you want to balance out the characters.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top