#pygments — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #pygments, aggregated by home.social.
-
Does anyone here know #pygments or #chroma lexer stuff well enough to tell me how (if at all?) one can mark up stuff in *multiple ways at once*?
For instance the following line:
# foo **bar**
The entire line should be a "Heading", the first two characters and the stars should be "Keyword"s, and the bar should be "GenericStrong".
I can't for the life of me figure out how that's possible to achieve.
CC @avghelper
-
Does anyone here know #pygments or #chroma lexer stuff well enough to tell me how (if at all?) one can mark up stuff in *multiple ways at once*?
For instance the following line:
# foo **bar**
The entire line should be a "Heading", the first two characters and the stars should be "Keyword"s, and the bar should be "GenericStrong".
I can't for the life of me figure out how that's possible to achieve.
CC @avghelper
-
When in doubt of which type of code block alias to use in your RST file, pygments provides all available lexers 📜 for a neat documentation project
https://pygments.org/docs/lexers/
#pygments #RST #sphinx -
When in doubt of which type of code block alias to use in your RST file, pygments provides all available lexers 📜 for a neat documentation project
https://pygments.org/docs/lexers/
#pygments #RST #sphinx -
When in doubt of which type of code block alias to use in your RST file, pygments provides all available lexers 📜 for a neat documentation project
https://pygments.org/docs/lexers/
#pygments #RST #sphinx -
When in doubt of which type of code block alias to use in your RST file, pygments provides all available lexers 📜 for a neat documentation project
https://pygments.org/docs/lexers/
#pygments #RST #sphinx -
I'm wrapping up the last two pages of documentation for my thing and while documenting a handful of example commands in interactive mode, I thought
"Man wouldn't it be nice if this had syntax highlighting, at least for keywords and arguments? I wouldn't need to use 'console' for sphinx code blocks, and it would not be this drab gray..."
Fast forward 45 minutes later, I'm in the middle of a gnarly custom Pygments regex lexer and I think:
"Oh but what if I just read the commands module source tree and parsed the AST to extract command names from functions that have the typer decorator? I would never need to maintain that list again and they'd always be keywords!"
The real "What the fuck am I doing with my life?" moment was marginally offset by how it actually worked on first try, against all expectations.
Sphinx is insidious. Once you start extending it there's no end in sight.
-
I'm wrapping up the last two pages of documentation for my thing and while documenting a handful of example commands in interactive mode, I thought
"Man wouldn't it be nice if this had syntax highlighting, at least for keywords and arguments? I wouldn't need to use 'console' for sphinx code blocks, and it would not be this drab gray..."
Fast forward 45 minutes later, I'm in the middle of a gnarly custom Pygments regex lexer and I think:
"Oh but what if I just read the commands module source tree and parsed the AST to extract command names from functions that have the typer decorator? I would never need to maintain that list again and they'd always be keywords!"
The real "What the fuck am I doing with my life?" moment was marginally offset by how it actually worked on first try, against all expectations.
Sphinx is insidious. Once you start extending it there's no end in sight.
-
… the #Pygments lexer for #CommonLisp treats ‘defun’ and ‘list*’ (among other symbols) as basically the same thing. They're both ‘builtins’.
As the kids say, my disappointment is immeasurable.
Ggghh, emacs --batch + font-lock-fontify-buffer + output the face changes maybe?
-
… the #Pygments lexer for #CommonLisp treats ‘defun’ and ‘list*’ (among other symbols) as basically the same thing. They're both ‘builtins’.
As the kids say, my disappointment is immeasurable.
Ggghh, emacs --batch + font-lock-fontify-buffer + output the face changes maybe?
-
If you use the pygments syntax highlighter (for example in your documentation), and you have examples that produce output (for example from the shell or Python REPL), here is a tip that I just discovered: look for the "console session" version of your language on this page: https://pygments.org/languages/
It keeps the language's syntactic coloring while dealing correctly with the prompt and output. Also when you copy the code, it will avoid copying the prompt. -
If you use the pygments syntax highlighter (for example in your documentation), and you have examples that produce output (for example from the shell or Python REPL), here is a tip that I just discovered: look for the "console session" version of your language on this page: https://pygments.org/languages/
It keeps the language's syntactic coloring while dealing correctly with the prompt and output. Also when you copy the code, it will avoid copying the prompt. -
Service toot: Just in case you need a reason to update your #TeXLive:
#minted finally release the 3.0.0 which provides an own binary which makes the python/ #pygments setup obsolete. This also drops the requirement of shell-escape (or different hacks) to use the syntax highlighting.
Ensure to not only update the package itself, as you also need to update the settings which allow it to run in restricted mode.
-
Service toot: Just in case you need a reason to update your #TeXLive:
#minted finally release the 3.0.0 which provides an own binary which makes the python/ #pygments setup obsolete. This also drops the requirement of shell-escape (or different hacks) to use the syntax highlighting.
Ensure to not only update the package itself, as you also need to update the settings which allow it to run in restricted mode.
-
#pygments 、Racket のコードもちゃんとシンタックスハイライティングしてくれるのかなり嬉しいな。
Racket に最初から入っている手続きに色が付いているので Racket の手続きやマクロのリストを持っているっぽい。
すばらしい。 -
Is Brent Roose on the Fediverse anywhere? I love this idea, and I’d love to help contribute.
I started down the path of trying to port #Pygments to #PHP a while back. I maintained a PHP wrapper for it (https://github.com/ramsey/pygments), and even set up a GitHub organization for “Phygments.” 😉 https://github.com/phygments
I want to help make this happen. Maybe I’ll have to email Brent if he’s not on the Fediverse.
@freekmurze @pronskiy Do either of you know if he’s here? https://mastodon.social/@php_discussions/112118298296419881
-
Is Brent Roose on the Fediverse anywhere? I love this idea, and I’d love to help contribute.
I started down the path of trying to port #Pygments to #PHP a while back. I maintained a PHP wrapper for it (https://github.com/ramsey/pygments), and even set up a GitHub organization for “Phygments.” 😉 https://github.com/phygments
I want to help make this happen. Maybe I’ll have to email Brent if he’s not on the Fediverse.
@freekmurze @pronskiy Do either of you know if he’s here? https://mastodon.social/@php_discussions/112118298296419881
-
I used two default styles of "pygments" with high contrast ratio 🎨
https://pygments.org/styles/ -
At last, submitted a proposal for a #Python source code annotator for #wily, by @tonybaloney.
It allows inline visualization of code metrics in source code, inspired by @coveragepy
Uses #radon to calculate #Cyclomatic #Complexity and #Halstead metrics, then adds color coded metric values to a #Pygments highlighted source listing and allows changing the metrics for visualization.
The code works, there are screenshots and an example in the linked issue.
-
At last, submitted a proposal for a #Python source code annotator for #wily, by @tonybaloney.
It allows inline visualization of code metrics in source code, inspired by @coveragepy
Uses #radon to calculate #Cyclomatic #Complexity and #Halstead metrics, then adds color coded metric values to a #Pygments highlighted source listing and allows changing the metrics for visualization.
The code works, there are screenshots and an example in the linked issue.
-
At last, submitted a proposal for a #Python source code annotator for #wily, by @tonybaloney.
It allows inline visualization of code metrics in source code, inspired by @coveragepy
Uses #radon to calculate #Cyclomatic #Complexity and #Halstead metrics, then adds color coded metric values to a #Pygments highlighted source listing and allows changing the metrics for visualization.
The code works, there are screenshots and an example in the linked issue.
-
At last, submitted a proposal for a #Python source code annotator for #wily, by @tonybaloney.
It allows inline visualization of code metrics in source code, inspired by @coveragepy
Uses #radon to calculate #Cyclomatic #Complexity and #Halstead metrics, then adds color coded metric values to a #Pygments highlighted source listing and allows changing the metrics for visualization.
The code works, there are screenshots and an example in the linked issue.
-
At last, submitted a proposal for a #Python source code annotator for #wily, by @tonybaloney.
It allows inline visualization of code metrics in source code, inspired by @coveragepy
Uses #radon to calculate #Cyclomatic #Complexity and #Halstead metrics, then adds color coded metric values to a #Pygments highlighted source listing and allows changing the metrics for visualization.
The code works, there are screenshots and an example in the linked issue.
-
Working on a #Python source code annotator for #wily, which uses #radon to calculate #Cyclomatic #Complexity and #Halstead metrics. It adds metric values to a #Pygments highlighted source listing and allows changing the metrics for visualization.
Because radon doesn't record line numbers for Halstead metrics, we do a little song and dance to add them. Will probably offer a patch to include them upstream.
https://devdanzin.github.io/wily/annotated_src.annotator.py.html
-
Working on a #Python source code annotator for #wily, which uses #radon to calculate #Cyclomatic #Complexity and #Halstead metrics. It adds metric values to a #Pygments highlighted source listing and allows changing the metrics for visualization.
Because radon doesn't record line numbers for Halstead metrics, we do a little song and dance to add them. Will probably offer a patch to include them upstream.
https://devdanzin.github.io/wily/annotated_src.annotator.py.html
-
Working on a #Python source code annotator for #wily, which uses #radon to calculate #Cyclomatic #Complexity and #Halstead metrics. It adds metric values to a #Pygments highlighted source listing and allows changing the metrics for visualization.
Because radon doesn't record line numbers for Halstead metrics, we do a little song and dance to add them. Will probably offer a patch to include them upstream.
https://devdanzin.github.io/wily/annotated_src.annotator.py.html
-
Working on a #Python source code annotator for #wily, which uses #radon to calculate #Cyclomatic #Complexity and #Halstead metrics. It adds metric values to a #Pygments highlighted source listing and allows changing the metrics for visualization.
Because radon doesn't record line numbers for Halstead metrics, we do a little song and dance to add them. Will probably offer a patch to include them upstream.
https://devdanzin.github.io/wily/annotated_src.annotator.py.html
-
Working on a #Python source code annotator for #wily, which uses #radon to calculate #Cyclomatic #Complexity and #Halstead metrics. It adds metric values to a #Pygments highlighted source listing and allows changing the metrics for visualization.
Because radon doesn't record line numbers for Halstead metrics, we do a little song and dance to add them. Will probably offer a patch to include them upstream.
https://devdanzin.github.io/wily/annotated_src.annotator.py.html
-
Today @bd808 and I updated the #Pygments syntax highlighter on #Wikimedia from version 2.11.2 to 2.15.1 and saw a pretty nice drop in latency so far!
Also brought in some new languages, including the long-requested "wikitext"! You can now highlight wikitext markup in wikitext! lots of documentation to update :)
https://phabricator.wikimedia.org/T334433
-
Today @bd808 and I updated the #Pygments syntax highlighter on #Wikimedia from version 2.11.2 to 2.15.1 and saw a pretty nice drop in latency so far!
Also brought in some new languages, including the long-requested "wikitext"! You can now highlight wikitext markup in wikitext! lots of documentation to update :)
https://phabricator.wikimedia.org/T334433
-
TIL: when pytest shows code, it automatically adds syntax highlighting if pygments is installed <3
(pictured: the same test before vs. after installing pygments in the venv)
-
TIL: when pytest shows code, it automatically adds syntax highlighting if pygments is installed <3
(pictured: the same test before vs. after installing pygments in the venv)
-
#MediaWiki uses the #Pygments syntax highlighter to enable rich formatting of code blocks: https://www.mediawiki.org/wiki/Extension:SyntaxHighlight
diskdance has submitted a pull request to add a lexer to support #wikitext markup: https://github.com/pygments/pygments/pull/2373
Hopefully it'll be in a release soon, to be used in on-wiki help pages and documentation!
(h/t to rundg for spotting)
-
#MediaWiki uses the #Pygments syntax highlighter to enable rich formatting of code blocks: https://www.mediawiki.org/wiki/Extension:SyntaxHighlight
diskdance has submitted a pull request to add a lexer to support #wikitext markup: https://github.com/pygments/pygments/pull/2373
Hopefully it'll be in a release soon, to be used in on-wiki help pages and documentation!
(h/t to rundg for spotting)
-
After almost 2 years, I finally released bepasty 1.1.0 (the universal pastebin), see there:
https://github.com/bepasty/bepasty-server/releases/tag/1.1.0
-
After almost 2 years, I finally released bepasty 1.1.0 (the universal pastebin), see there:
https://github.com/bepasty/bepasty-server/releases/tag/1.1.0
-
Wow, #pygments is amazing huh?
I have to explore the SVGFormatter class too... -
Wow, #pygments is amazing huh?
I have to explore the SVGFormatter class too... -
I think this #Pygments theme is the most Halloweeny of the bunch.
https://dpaste.com/styles/#inkpot
(I promise I will not submit a pull request to change its name to "Pumpkin Spice".)
-
Presuming there are other #Python developers besides me who periodically go looking for a simple visual catalog of #Pygments code-colorizing styles, I'll share this page I made last weekend: https://dpaste.com/styles
-
Managed to find a #sphinx theme that allows easily overridable CSS without having to modify the theme itself and applied a dark color scheme.
Will need to whip up a PR to get rid of about 3 lines that make it impossible to effectively change the #pygments color scheme, but besides that it's pretty damn nice in its simplicity (especially CSS-wise)
But first, sleep.