Senin, 15 Juli 2024

Syntax Highlight In Markdown Code Block

Syntax Highlight In Markdown Fenced Code Blocks

The Markdown syntax allows you to create code blocks by using three backticks (```) or three tildes (~~~) on the lines before and after the code block.

To add syntax highlighting, specify a language next to the backticks before the fenced code block.

In GFM (Github Flavor Markdown), syntax highlight language support are provide by Linguist. 

Here are some of syntax highlight language (light-weight markup language for documentation, programming language, database management system language, style-sheet, text to diagram, structured data parsing, document preparation system for the typesetting):

AsciiDoc, C, C#, C++, CSS, Go, HTML, Java, Javascript, Markdown, Mermaid, Objective-C, Pascal, PHP, PlantUML, Python, reStructuredText, R, Ruby, Shell, SQL, Swift, TeX, VBScript, XML, YAML.

The other syntax highlight language, click here to download the Syntax Language Highlight Prism JS (Academia.edu) 

The following syntax highlight, using hljs

EXAMPLE

  • AsciiDoc Syntax Highlight In Markdown Fenced Code Blocks
    type this following markdown code in your markdown editor:
    ```asciidoc
    Heading 1
    ========
    A paragraph is defined by one or more consecutive lines of text.  +

    trailing with *hard line break* ( space bar and plus sign ).
    ```

    Result

    Heading 1
    ========
    A paragraph is defined by one or more consecutive lines of text. + trailing with *hard line break* ( space bar and plus sign ).
  • C Syntax Highlight In Markdown Fenced Code Blocks
    type this following markdown code in your markdown editor:
    ```c
    /* Hello World in C */

    #include <stdio.h>

    int main(void)
    {
      puts("Hello World!");
      return 0;
    }
    ```

    Result

    
    /* Hello World in C */
    
    #include <stdio.h>
    
    int main(void)
    {
      puts("Hello World!");
      return 0;
    }
    
    

Reference

http://helloworldcollection.de/

https://highlightjs.org/

https://mikkegoes.com/

https://www.digitalocean.com/

Tidak ada komentar:

Posting Komentar

Various Other Posts