Skip to content

Create a lexer for Markless.#3018

Open
Shinmera wants to merge 1 commit intopygments:masterfrom
Shinmera:master
Open

Create a lexer for Markless.#3018
Shinmera wants to merge 1 commit intopygments:masterfrom
Shinmera:master

Conversation

@Shinmera
Copy link

Markless is an open document markup standard specified at

https://shirakumo.org/docs/markless

Reference implementations of full parsers, a test suite, sample documents, and more can be found on the same page.

This lexer implements a simpler version of Markless without maintaining the standard component and directive stack. It also does not distinguish every possible component type in Markless, as Pygments/Chroma's types lack appropriate markers.

Nevertheless the lexer is useful enough to properly mark up syntax constructs in Markless documents, especially aiding in distinguishing syntactical elements from actual textual content at a glance.

2026 01 14 20:23:07

If there's anything you'd like me to provide about Markless or change about the patch, please let me know.

Thanks a lot for all your work on Pygments!

@Shinmera Shinmera force-pushed the master branch 2 times, most recently from 3ca7f7e to f3940db Compare January 15, 2026 15:07
@Shinmera
Copy link
Author

Sorry for the linter issue in the workflow, I've fixed it now. I couldn't run the linter on my own system, it would complain as follows:

tox -e regexlint
.pkg: _optional_hooks> python /usr/lib/python3.14/site-packages/pyproject_api/_backend.py True hatchling.build
.pkg: get_requires_for_build_editable> python /usr/lib/python3.14/site-packages/pyproject_api/_backend.py True hatchling.build
.pkg: build_editable> python /usr/lib/python3.14/site-packages/pyproject_api/_backend.py True hatchling.build
regexlint: install_package> python -I -m pip install --force-reinstall --no-deps /home/linus/Projects/python/pygments/.tox/.tmp/package/56/pygments-2.19.2-py3-none-any.whl
regexlint: commands[0]> regexlint pygments.lexers
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/usr/lib/python3.14/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
                    ~~~~^^^^^^^^^^^^^^^
  File "/home/linus/Projects/python/pygments/.tox/regexlint/lib/python3.14/site-packages/regexlint/cmdline.py", line 183, in check_lexer_map
    return check_lexer(*args)
  File "/home/linus/Projects/python/pygments/.tox/regexlint/lib/python3.14/site-packages/regexlint/cmdline.py", line 259, in check_lexer
    foo = find_offending_line(mod_path, lexer_name, state, i,
                              pos1)
  File "/home/linus/Projects/python/pygments/.tox/regexlint/lib/python3.14/site-packages/regexlint/indicator_ast.py", line 54, in find_offending_line
    if isinstance(key, ast.Str) and key.s == state:
                       ^^^^^^^
AttributeError: module 'ast' has no attribute 'Str'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/linus/Projects/python/pygments/.tox/regexlint/bin/regexlint", line 7, in <module>
    sys.exit(main())
             ~~~~^^
  File "/home/linus/Projects/python/pygments/.tox/regexlint/lib/python3.14/site-packages/regexlint/cmdline.py", line 132, in main
    for (stream, has_errors) in pool.imap(check_lexer_map, lexers_to_check):
                                ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/multiprocessing/pool.py", line 873, in next
    raise value
AttributeError: module 'ast' has no attribute 'Str'
regexlint: exit 1 (4.48 seconds) /home/linus/Projects/python/pygments> regexlint pygments.lexers pid=71271
.pkg: _exit> python /usr/lib/python3.14/site-packages/pyproject_api/_backend.py True hatchling.build
  regexlint: FAIL code 1 (4.96=setup[0.48]+cmd[4.48] seconds)
  evaluation failed :( (5.03 seconds)

@Anteru
Copy link
Collaborator

Anteru commented Jan 15, 2026

The linter issue should be fixed now, it was a problem with regexlint not supporting newer Python versions (I only fixed it yesterday.)

Markless is an open document markup standard specified at

  https://shirakumo.org/docs/markless

Reference implementations of full parsers, a test suite, sample
documents, and more can be found on the same page.

This lexer implements a simpler version of Markless without
maintaining the standard component and directive stack. It also does
not distinguish every possible component type in Markless, as
Pygments/Chroma's types lack appropriate markers.

Nevertheless the lexer is useful enough to properly mark up syntax
constructs in Markless documents, especially aiding in distinguishing
syntactical elements from actual textual content at a glance.
@Shinmera
Copy link
Author

Is there anything else I can do to get this merged?

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.

2 participants