Skip to content

Commit 6e58ac0

Browse files
authored
Add syntax coloring support
1 parent 2d0b221 commit 6e58ac0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/sql/magic.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import re
22
from IPython.core.magic import Magics, magics_class, cell_magic, line_magic, needs_local_scope
3+
from IPython.display import display_javascript
34
try:
45
from traitlets.config.configurable import Configurable
56
from traitlets import Bool, Int, Unicode
@@ -133,4 +134,6 @@ def _persist_dataframe(self, raw, conn, user_ns):
133134

134135
def load_ipython_extension(ip):
135136
"""Load the extension in IPython."""
137+
js = "IPython.CodeCell.config_defaults.highlight_modes['magic_sql'] = {'reg':[/^%%sql/]};"
138+
display_javascript(js, raw=True)
136139
ip.register_magics(SqlMagic)

0 commit comments

Comments
 (0)