Skip to content

[UX][TVMSciprt] Use HTML formatter in notebook environments#12240

Merged
junrushao merged 2 commits intoapache:mainfrom
ganler:script-highlight-fix-colab
Jul 30, 2022
Merged

[UX][TVMSciprt] Use HTML formatter in notebook environments#12240
junrushao merged 2 commits intoapache:mainfrom
ganler:script-highlight-fix-colab

Conversation

@ganler
Copy link
Copy Markdown
Contributor

@ganler ganler commented Jul 30, 2022

Previously we use ANSI color sequences to highlight TVM script. In jupyter notebook environments, such color sequence will be recoginized and translated to corresponding HTML to display things.

This works fine for most notebook environments (including the jupyter notebook and the VS Code plugin). Recently, thanks to @tqchen, we found that Google Colab does not well support ansi color sequence for 24-bit colors (JupyterLight and VSCDark) that all its displayed colors are unexpectedly black/gray/white. To also bring highlighting in Colab, in this PR, we directly render the highlighted code with HTML when a notebook environment is detected.

cc: @tqchen @Hzfengsy

Copy link
Copy Markdown
Member

@Hzfengsy Hzfengsy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@junrushao junrushao merged commit e756980 into apache:main Jul 30, 2022
xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 25, 2022
…2240)

Previously we use ANSI color sequences to highlight TVM script. In jupyter notebook environments, such color sequence will be recoginized and translated to corresponding HTML to display things. 

This works fine for most notebook environments (including the jupyter notebook and the VS Code plugin). Recently, thanks to @tqchen, we found that Google Colab does not well support ansi color sequence for 24-bit colors (`JupyterLight` and `VSCDark`) that all its displayed colors are unexpectedly black/gray/white. To also bring highlighting in Colab, in this PR, we directly render the highlighted code with HTML when a notebook environment is detected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants