How to use HTML syntax within Github Markdown to display code in Highlight?

Asked

Viewed 108 times

0

On Github it is possible to display an Highlight code with Markdown syntax, as follows (consider the simple quotes being the grave accent `):

Este é meu arquivo README.md

'''dart
void main() {
 // Este é meu código em highlight para a linguagem Dart
}
'''

That is, in Mardown we use three bass accents to indicate the beginning of the Highlight code, and three to indicate the end. But how do I do it without using this Markdown syntax and yes HTML syntax?

Este é meu arquivo README.md

<pre>
  <code>
    void main(){
      // Meu código em highlight para linguagem Dart mas em sintaxe HTML dentro do markdown
    }
  </code>
</pre>

1 answer

0

The answer to this question is simple, there is no way to apply an "HTML syntax" within the Markdown to Highlight code on Github. The only way is the one you mentioned, which is by using the acute accent (`).

If you need to place code with Highlight syntax inside a Markdown with HTML code, for example, a details, just give a row of space between the HTML code and the acute accents, ie would look this way (consider the simple quotation marks being the grave accent `):

<details>
  <summary>Seu código HTML dentro do arquivo markdown</summary>

'''dart
void main() {
  // Código com sintaxe highlight não muda, independente se está dentro do HTML ou fora.
}
'''
</details>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.