Skip to content

Conversation

@vdonato
Copy link
Collaborator

@vdonato vdonato commented Apr 16, 2021

We changed the behavior of auto-syntax highlighting in code blocks in #2814 to
not attempt to highlight code as if it were python if the language
specified isn't a supported one, which had the side effect of removing
syntax highlighting from toml code blocks (toml was being highlighted as if it
were python). This change adds toml highlighting back using prismjs' native
support.

We also re-order and re-group the imports in the file.

Note that it's possible for syntax highlighting in general to not look great in alert
boxes because there are 4 possible background colors that they can be, and
I filed #3156 to address this. Since we still highlight syntax for other supported
languages, I think we should still re-add toml syntax highlighting as its strictly
better than not having it, and code blocks for other languages in alert boxes still
have potential display issues.

@vdonato vdonato requested a review from a team April 16, 2021 05:50
@vdonato vdonato marked this pull request as draft April 16, 2021 06:19
@vdonato
Copy link
Collaborator Author

vdonato commented Apr 20, 2021

I filed #3156 to remind myself to revisit how syntax highlighting and alert boxes interact in general. Closing this for now. I think we most likely want to still merge this change in so that we highlight toml code blocks again since syntax highlighting for other languages still has the problems detailed in #3156 anyway.

@vdonato vdonato closed this Apr 20, 2021
@vdonato vdonato deleted the readd-toml-highlighting branch April 20, 2021 23:10
@vdonato vdonato restored the readd-toml-highlighting branch April 22, 2021 21:52
@vdonato vdonato reopened this Apr 22, 2021
@vdonato vdonato marked this pull request as ready for review April 22, 2021 21:52
We changed the behavior of auto-syntax highlighting in code blocks in streamlit#2814 to
*not* attempt to highlight code as if it were python if the language
specified isn't a supported one, which had the side effect of removing
syntax highlighting from toml code blocks (toml was being highlighted as if it
were python). This change adds toml highlighting back using prismjs' native
support.

We also re-order and re-group the imports in the file.
@vdonato vdonato force-pushed the readd-toml-highlighting branch from 7375ee7 to 2739ade Compare April 26, 2021 22:03
@stale
Copy link

stale bot commented May 11, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 11, 2021
@vdonato
Copy link
Collaborator Author

vdonato commented May 11, 2021

comment to un-stale

@stale stale bot removed the stale label May 11, 2021
@asaini
Copy link

asaini commented May 13, 2021

TOML highlighting looking pretty good 👍

Screen Shot 2021-05-12 at 8 37 48 PM

Screen Shot 2021-05-12 at 9 13 39 PM

@vdonato vdonato merged commit ecf91b7 into streamlit:develop May 13, 2021
@vdonato vdonato deleted the readd-toml-highlighting branch May 13, 2021 04:50
tconkling added a commit to tconkling/streamlit that referenced this pull request May 17, 2021
* develop:
  Remove tag from PR template (streamlit#3284)
  Add test req version bound for TF to fix tests (streamlit#3266)
  Add support for toml syntax highlighting in code blocks (streamlit#3140)
  Don't allow config.get_option to be called on file import (streamlit#3235)
  pin click to < 8.0 (streamlit#3256)
  Random cleanup: docstrings + type-safety (streamlit#3252)
  "setWidgetValue" -> "commitWidgetValue" (streamlit#3253)
tconkling added a commit that referenced this pull request May 18, 2021
* develop: (75 commits)
  Remove tag from PR template (#3284)
  Add test req version bound for TF to fix tests (#3266)
  pin click to < 8.0 (#3256)
  Up version to 0.82.0
  Update change log
  Add support for toml syntax highlighting in code blocks (#3140)
  Don't allow config.get_option to be called on file import (#3235)
  pin click to < 8.0 (#3256)
  Random cleanup: docstrings + type-safety (#3252)
  "setWidgetValue" -> "commitWidgetValue" (#3253)
  Fix inactive DatePicker if the date value is 10 years earlier (#3241)
  Upgrade trim to 0.0.3 or later (#3250)
  Manually name all snapshots and generate missing ones (#3205)
  Fix Video Recorded modal dialog width (#3226)
  Bump handlebars from 4.7.6 to 4.7.7 in /frontend (#3238)
  Bump hosted-git-info from 2.8.8 to 2.8.9 in /frontend (#3234)
  Bump lodash from 4.17.20 to 4.17.21 in /frontend (#3233)
  Bump ua-parser-js from 0.7.23 to 0.7.28 in /frontend (#3231)
  Update FAQs with supported browsers (#3225)
  Update copyright date (#3228)
  ...
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