0

I am trying to do an SCSS code block in Markdown but cannot get the ampersand to show up.

.my-class {
  &:before{
    margin-right: 5px;
  }
}

Here is what I have tried so far along with results:

& shows the text.

& shows the literal of what I just typed.

& just shows a space.

Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223
Jason
  • 1,316
  • 13
  • 25
  • what do you mean, ampersands don't show up in markdown? It did show up here. – Sergio Tulentsev Jan 23 '18 at 12:13
  • Please provide the rendered HTML and perhaps also the HTML you expected. You may need to use your browsers "view source" feature to access the HTML. – Waylan Jan 24 '18 at 13:49
  • yes, it shows up here. I am doing it in markdown using compodoc. I can't figure out a way to just show you what my markdown looks like because it ends up formatted here. If I don't mark it as code block then stack overflow will not let me post it. basically I am wrapping what is above with ```css. I expect to see & but instead I see a space if I do &, and the literal string for the other two. – Jason Jan 25 '18 at 15:09

1 Answers1

0

Try to enter a zero-width space after the ampersand:

.my-class {
  &<zero-width space>:before{
    margin-right: 5px;
  }
}

You can copy a zero-width space from this Wikipedia article.

Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223