Skip to content

Commit 7e547b7

Browse files
Merge pull request #75 from xiaochuanyu/patch-1
Add syntax coloring support
2 parents eb08bea + 6e58ac0 commit 7e547b7

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
@@ -147,4 +148,6 @@ def _persist_dataframe(self, raw, conn, user_ns):
147148

148149
def load_ipython_extension(ip):
149150
"""Load the extension in IPython."""
151+
js = "IPython.CodeCell.config_defaults.highlight_modes['magic_sql'] = {'reg':[/^%%sql/]};"
152+
display_javascript(js, raw=True)
150153
ip.register_magics(SqlMagic)

0 commit comments

Comments
 (0)