home.social

#pygments — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #pygments, aggregated by home.social.

  1. 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

  2. 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
    pygments.org/docs/lexers/
    #pygments #RST #sphinx

  3. 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.

    #codequality

    github.com/tonybaloney/wily/is

  4. 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.

    #codequality 🐍

    devdanzin.github.io/wily/annot

  5. #MediaWiki uses the #Pygments syntax highlighter to enable rich formatting of code blocks: mediawiki.org/wiki/Extension:S

    diskdance has submitted a pull request to add a lexer to support #wikitext markup: github.com/pygments/pygments/p

    Hopefully it'll be in a release soon, to be used in on-wiki help pages and documentation!

    (h/t to rundg for spotting)