0

How do I escape the hash value inside a code snippet in markdown? All tries resulted to a red display of the character (invalid)

```gradle
# My gradle comment
artifactory_user=YOUR_ARTIFACTORY_USER
artifactory_password=YOUR_ARTIFACTORY_PW
```

I tried already

\\#
\#
##
#

None of these works?!

Fahim
  • 1,431
  • 1
  • 15
  • 28

1 Answers1

2

That's because it is invalid. Gradle syntax is based on Groovy syntax. Single-line comments in both Gradle and Groovy use //, not #:

```gradle
// My gradle comment
```

Thanks for the OP for pointing out that gradle.properties files use # for comments. The following code block with the language set to properties works as expected:

```properties
# My gradle comment
artifactory_user=YOUR_ARTIFACTORY_USER
artifactory_password=YOUR_ARTIFACTORY_PW
```
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • 1
    You are fully right, I got messed up since it was the gradle.properties. So the right syntax is "properties"... and then it works without any escaping character. – Fahim Aug 23 '17 at 12:46