Title: python3: a # in an f-string breaks syntax highlighting · Issue #225 · MagicStack/MagicPython · GitHub
Open Graph Title: python3: a # in an f-string breaks syntax highlighting · Issue #225 · MagicStack/MagicPython
X Title: python3: a # in an f-string breaks syntax highlighting · Issue #225 · MagicStack/MagicPython
Description: See the code below. Since my issue exists on github, I can simply demonstrate my exact issue with the example code block below. Basically, when a # is used within an f-string, then it appears to break the syntax highlighting. It looks li...
Open Graph Description: See the code below. Since my issue exists on github, I can simply demonstrate my exact issue with the example code block below. Basically, when a # is used within an f-string, then it appears to br...
X Description: See the code below. Since my issue exists on github, I can simply demonstrate my exact issue with the example code block below. Basically, when a # is used within an f-string, then it appears to br...
Opengraph URL: https://github.com/MagicStack/MagicPython/issues/225
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"python3: a # in an f-string breaks syntax highlighting","articleBody":"See the code below. Since my issue exists on github, I can simply demonstrate my exact issue with the example code block below. Basically, when a # is used within an f-string, then it appears to break the syntax highlighting. It looks like the \"#\" in the f-string gets interpreted as the start of a comment, even though this is correctly handled for non-f-srings. The # in the format string is used to get the alternate form for the hex conversion. Here is an example of what the \"#\" does in a format string as well as demonstrate the bug:\r\n\r\n```python\r\n\u003e\u003e\u003e # syntax highlighting works here...\r\n\u003e\u003e\u003e i = 5\r\n\u003e\u003e\u003e '{:#04x}'.format(i) # \u003c-- not using an f-string is fine\r\n'0x05'\r\n\u003e\u003e\u003e f'{i:04x}'\r\n'0005'\r\n\u003e\u003e\u003e f'{i:#04x}' # \u003c---- this line breaks the syntax highlighting\r\n'0x05'\r\n\u003e\u003e\u003e f'{i:04x}' # \u003c-- syntax highlighting is broken!\r\n'0005'\r\n\u003e\u003e\u003e '{:#04x}'.format(i) # \u003c-- syntax highlighting is broken!\r\n'0x05'\r\n\u003e\u003e\u003e \r\n```\r\n\r\nHere is a screenshot to demonstrate the issue (for future reference) since, after this bug is fixed, the code above will presumably have the correct highlighting:\r\n\r\n\r\n\r\n\r\nEdit: corrected the 4th output from `0x05` to `0005`","author":{"url":"https://github.com/Spectre5","@type":"Person","name":"Spectre5"},"datePublished":"2020-11-12T01:53:58.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/225/MagicPython/issues/225"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ef2d8638-a918-31be-1bdc-911127608b63 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 80C4:346A19:27755E:36F1BB:6972107D |
| html-safe-nonce | afdeada163117a56c0664447b2bcafff47889596f0c71e59d1def8cff4d8e3ab |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MEM0OjM0NkExOToyNzc1NUU6MzZGMUJCOjY5NzIxMDdEIiwidmlzaXRvcl9pZCI6IjI2MDMyMjIzMzc0ODk4NjY4NzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 55a6ac488b3cfed488172633ffc743815cdc5095e9e8b57edb720ca43cf7edfa |
| hovercard-subject-tag | issue:741204607 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/MagicStack/MagicPython/225/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0855ea9596b77f1e35e1f64383da1bd5e43583febe1d98edc34d03b56329ad8f/MagicStack/MagicPython/issues/225 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0855ea9596b77f1e35e1f64383da1bd5e43583febe1d98edc34d03b56329ad8f/MagicStack/MagicPython/issues/225 |
| og:image:alt | See the code below. Since my issue exists on github, I can simply demonstrate my exact issue with the example code block below. Basically, when a # is used within an f-string, then it appears to br... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Spectre5 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 453de246939b1e04d711e109432e2df10933270413df93b7a8f8f1df8dda7f18 |
| turbo-cache-control | no-preview |
| go-import | github.com/MagicStack/MagicPython git https://github.com/MagicStack/MagicPython.git |
| octolytics-dimension-user_id | 14324950 |
| octolytics-dimension-user_login | MagicStack |
| octolytics-dimension-repository_id | 43982620 |
| octolytics-dimension-repository_nwo | MagicStack/MagicPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 43982620 |
| octolytics-dimension-repository_network_root_nwo | MagicStack/MagicPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 12756e5bdb9000be815bbf20a1acc7935638e596 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width