0

I would like to print a string with sql into my jupyter notebook like below enter image description here

This was done manually with pygments, see

Here is what I tried so far

from pygments import highlight
from pygments.lexers import SqlLexer
from pygments.formatters import HtmlFormatter
from IPython.core.display import HTML, display
query = '''
SELECT
   *
FROM
   latest.tmp
'''
display(HTML(highlight(query, SqlLexer(), HtmlFormatter())))

In the output keywords are neither green nor bold. (I am using Jupyterlab.)

enter image description here

PalimPalim
  • 2,892
  • 1
  • 18
  • 40

1 Answers1

0

You need to also set HtmlFormatter(full=True)

enter image description here

PalimPalim
  • 2,892
  • 1
  • 18
  • 40