Enhancements/Fixes to Less Lexer

Issue #1330 resolved
Mark Lautman
created an issue

This is a request for three fixes or enchancements to the less lexer:

  • allow nested statements
  • support ampersand (&) notation
  • support at (@) notation

Note: This ticket is an elaboration of https://bitbucket.org/birkenfeld/pygments-main/issues/780/add-a-less-lexer.

Nested Statements

I have the following nested code:

#header {

   color: black;

.navigation {

     font-size: 12px;


 .logo {

   width: 300px;



The entry at http://pygments.org/demo/6347875/ gives two errors in red rectangles, and inside Sphinx the following error appears WARNING: Could not lex literal_block as "less". Highlighting skipped.

(In contrast, the linter at http://lesstester.com/ provides correct synatx highlighting.)

Inside Sphinx, using .. code-block:: scss produces some syntax highlighting, but not as rich as the css lexer.

Ampersand Notation

As part of this request, please support the ampersand notation (&), as in the following snippet.

.Article {
      &-headline {

(May be related to https://bitbucket.org/birkenfeld/pygments-main/issues/1321/scss-highlighting-variables)

At Notation

Need highlighting for @ directives (variables, mixins), as in the following snippet

@typesize: 12px;

.header {
   font-size: @typesize;

.footer {
   font-size: @typesize;

Please ensure syntax highlighting allows for hyphenation in the @ identifier. For example, @type-size: 12px; has correct highlighting.

Comments (1)

  1. Log in to comment