{"id":41209770,"url":"https://github.com/rsmenon/pygments-mathematica","last_synced_at":"2026-01-22T22:53:59.844Z","repository":{"id":53166461,"uuid":"51734191","full_name":"rsmenon/pygments-mathematica","owner":"rsmenon","description":"Mathematica/Wolfram Language lexer and highlighter for Pygments","archived":false,"fork":false,"pushed_at":"2025-03-16T01:47:54.000Z","size":247,"stargazers_count":60,"open_issues_count":2,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-11-02T07:23:40.366Z","etag":null,"topics":["highlighting","lexer","mathematica","pygments"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rsmenon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-15T06:01:51.000Z","updated_at":"2025-08-01T07:54:21.000Z","dependencies_parsed_at":"2023-01-31T01:15:16.757Z","dependency_job_id":null,"html_url":"https://github.com/rsmenon/pygments-mathematica","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/rsmenon/pygments-mathematica","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsmenon%2Fpygments-mathematica","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsmenon%2Fpygments-mathematica/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsmenon%2Fpygments-mathematica/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsmenon%2Fpygments-mathematica/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rsmenon","download_url":"https://codeload.github.com/rsmenon/pygments-mathematica/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsmenon%2Fpygments-mathematica/sbom","scorecard":{"id":787413,"data":{"date":"2025-08-11","repo":{"name":"github.com/rsmenon/pygments-mathematica","commit":"09a38d87a486a0e8821f4e607183968a54848d73"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.9,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":1,"reason":"Found 3/29 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/python-package.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-package.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/rsmenon/pygments-mathematica/python-package.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-package.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/rsmenon/pygments-mathematica/python-package.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yml:29","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yml:30","Warn: pipCommand not pinned by hash: .github/workflows/python-package.yml:31","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 9 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T06:26:48.094Z","repository_id":53166461,"created_at":"2025-08-23T06:26:48.094Z","updated_at":"2025-08-23T06:26:48.094Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28673280,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T20:48:19.482Z","status":"ssl_error","status_checked_at":"2026-01-22T20:48:14.968Z","response_time":144,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["highlighting","lexer","mathematica","pygments"],"created_at":"2026-01-22T22:53:59.772Z","updated_at":"2026-01-22T22:53:59.838Z","avatar_url":"https://github.com/rsmenon.png","language":"Python","readme":"# Mathematica lexer and highlighter for Pygments\n\nThe most up-to-date lexer and highlighter for [_Mathematica_](http://wolfram.com/mathematica)/Wolfram Language\n source code using the [pygments](http://pygments.org) engine.\n\n![](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)\n![](https://img.shields.io/badge/version-0.4.2-yellow.svg?style=flat-square)\n![](https://img.shields.io/badge/python-3.9%2B-lightgrey.svg?style=flat-square)\n![](https://img.shields.io/pypi/v/pygments-mathematica.svg?style=flat-square)\n## Features\n\nIt can currently lex and highlight:\n\n  - All builtin functions in the ``System` `` context including unicode symbols like `π` except those\n  that use characters from the private unicode space (e.g. `\\[FormalA]`).\n  - User defined symbols, including those in a context.\n  - All operators including unicode operators like `∈` and `⊕`.\n  - Comments, including multi line and nested.\n  - Strings, including multi line and escaped quotes.\n  - Patterns, slots (including named slots `#name` introduced in version 10) and slot sequences.\n  - Message names (e.g. the `ivar` in `General::ivar`)\n  - Numbers including base notation (e.g. `8 ^^ 23 == 19`) and scientific notation (e.g. `1 *^ 3 == 1000`).\n  - Local variables in `Block`, `With` and `Module`.\n\n### Example:\n```\n(* An example highlighting the features of\n   this Pygments plugin for Mathematica *)\nlissajous::usage = \"An example Lissajous curve.\\n\" \u003c\u003e\n                   \"Definition: f(t) = (sin(3t + π/2), sin(t))\"\nlissajous = {Sin[2^^11 # + 0.005`10 * 1*^2 * Pi], Sin[#]} \u0026;\n\nWith[{max = 2 Pi, min = 0},\n    ParametricPlot[lissajous[t], {t, min, max}] /. x_Line :\u003e {Dashed, x}\n]\n```\n\u003cimg width=\"700\" src=\"https://cloud.githubusercontent.com/assets/2389211/13201234/e974332e-d81c-11e5-986d-a8afbc4d8fff.png\"\u003e\n\n## Installation\n\n### Using `pip`\n\nRun `pip install pygments-mathematica` from the command line. That's it!\n\n### From source code\n\nIf you'd like to make modifications to the color scheme for personal use or if you'd like to try the\nmost recent release that might not yet be available in PyPi, download and unzip the source code\nfrom the [latest release](https://github.com/rsmenon/pygments-mathematica/releases/latest). After\nyou've [installed Pygments](http://pygments.org/download/) (`pip install Pygments` works well\nif you already have python setup on your system), run the following from the repo's root directory:\n\n```bash\npython setup.py install\n```\n\n## Usage\n\n### Server-side syntax highlighting in Jekyll, Octopress and other static websites\n\nTo highlight _Mathematica_ code using this lexer, enclose the code between these liquid tags:\n\n```\n{% highlight wl %}\n\u003cyour code here\u003e\n{% endhighlight %}\n```\n\nYou can also use `wolfram` and `wolfram-language` as the language hint. (See the note at the end of the section.)\n\nIf you are using Jekyll, depending on your setup, you might need to add the following in your `_plugins/ext.rb`:\n\n```ruby\nrequire 'pygments'\nPygments.start('\u003cpath to your python env\u003e/site-packages/pygments/')\n```\n\n\u003e **NOTE:** Although this lexer is registered with the names `mathematica` and `mma` for use as language hints, the\ndefault lexer that ships with Pygments overrides this. Hence until this is incorporated into the main Pygments repository\nplease use `wl` or `wolfram` or `wolfram-language` as the language hint.\n\n### Highlighting in LaTeX documents\n\n_Mathematica_ code can be highlighted in LaTeX documents using the [minted](http://mirrors.rit.edu/CTAN/macros/latex/contrib/minted/minted.pdf) (PDF) package.\nThe following minimal example shows how:\n\n```latex\n\\documentclass{article}\n\\usepackage[english]{babel}\n\\usepackage{fontspec}\n\\setmonofont{Menlo}\n\n\\usepackage{minted}\n\\usemintedstyle{mathematica}\n\n\\begin{document}\n\\begin{minted}[linenos=true]{wolfram}\n(* An example highlighting the features of\n   this Pygments plugin for Mathematica *)\nlissajous::usage = \"An example Lissajous curve.\\n\" \u003c\u003e\n                   \"Definition: f(t) = (sin(3t + Pi/2), sin(t))\"\nlissajous = {Sin[2^^11 # + 0.005`10 * 1*^2 * π], Sin[#]} \u0026;\n\nParametricPlot[lissajous[t], {t, 0, 2 π}] /. x_Line :\u003e {Dashed, x}\n\\end{minted}\n\\end{document}\n```\n\nSaving the above as `mma.tex` and running `xelatex --shell-escape mma.tex` should produce a PDF with highlighted code.\n\n\u003e *NOTE:* If your LaTeX colors don't show up properly, try deleting your `*.aux`, `*.log` files and any `_minted-mma/` directory before running XeLaTeX again.\n\n### Pelican static page generator\n\nThe [Pelican static generator](http://blog.getpelican.com/) is written in Python and uses Pygments by default. To use it there, you mark code blocks with the usual 4 spaces indent and you prepend it with `:::wl` if you are using Markdown\n\n```\n    :::wl\n    FileNames[\"CodeGenerator.m\", {$InstallationDirectory}, 4]\n    (*\n      {\"/Applications/Development/Mathematica.app/SystemFiles/Links/GPUTools/CodeGenerator.m\"}\n    *)\n```\n\nIf you are using ReStructuredText, please mark your *Mathematica* code with\n\n```\n.. code-block:: wl\n\n   \u003cindented code block goes here\u003e\n```\n\n### Command line usage\n\nThe `pygmentize` command can be used to invoke this lexer and convert any _Mathematica_ file to an appropriately\nhighlighted file in a different format. For example, to convert a file `package.m` to a HTML file, run\n\n```bash\npygmentize -O full,style=mathematica -f html -l wl -o package.html package.m\n```\n\n## Styles\n\nThe default styles that come with Pygments do not go well with _Mathematica_ code. If you're using this lexer\nfor highlighting source code on a website, use the `mma.scss` [Sass](http://sass-lang.com) file in this repository to obtain good default colors (as shown in the\nscreenshot). You can, if you choose, modify the colors in the SCSS file and then convert it to CSS\nusing the `scss` compiler as:\n\n```\nscss mma.scss \u003e mma.css\n```\n\nFor other applications including command line usage, the lexer ships with a style named `mathematica`.\n(See the arguments to the `pygmentize` command in the section above.) To use different colors, modify\nthe style in `mathematica/style.py` and run `python setup.py install` again.\n\nIf you fancy the default style that ships with the _Mathematica_ notebook, use the `mathematica-notebook` scheme.\n\n## Limitations\n\nIt cannot highlight lexically and dynamically scoped variables (e.g. the `x` in `With[{x = 1}, x + 1]` or\nthe `Plus` in `Block[{Plus = Times}, 2 + 3]`, etc.) consistently throughout their scope. This would require a\nparser that further processes the stream of tokens and builds an AST that captures the semantics of the language.\n\nThis is currently not a high priority since it is non-trivial to implement it within the framework\nby Pygments, but I am interested in supporting this eventually, so collaborations/pull requests are welcome :)\n\n## Acknowledgments\n\nThe lexing rules for _Mathematica_ syntax are largely based on two prior projects:\n\n - My [vim-mathematica](https://github.com/rsmenon/vim-mathematica) syntax highlighting plugin.\n - Patrick Scheibe's [Mathematica plugin for IntelliJ IDEA](https://github.com/halirutan/Mathematica-IntelliJ-Plugin) (if you develop in _Mathematica_ and\n haven't seen this yet, please do try it out. It's wonderful!).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frsmenon%2Fpygments-mathematica","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frsmenon%2Fpygments-mathematica","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frsmenon%2Fpygments-mathematica/lists"}