Back to Nextra

Code highlighting

examples/swr-site/content/en/docs/advanced/code-highlighting.mdx

2.0.0-beta.6668 B
Original Source

Code highlighting

Test filename, line highlighting and empty lines

js
console.log('hello world')

console.log('goodbye world')

Test showLineNumbers and word highlighting

scala
object Hello {
  def main(args: Array[String]) = {
    println("hello, world")
  }
}

object Hello {
  def main(args: Array[String]) = {
    println("hello, world")
  }
}

Test highlighting inline code

import React from 'react'{:js}

Test without specified language

text
hello world

Link to google

Link to GitHub