Skip to content

[insiders] Code block annotation alignment for comment lines #3145

Closed
@kcgthb

Description

Contribution guidelines

I've found a bug and checked that ...

  • ... the problem doesn't occur with the mkdocs or readthedocs themes
  • ... the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_css
  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

Code block annotations don't appear to be properly positioned on comment lines.

Expected behaviour

Properly aligned annotation mark.

Actual behaviour

The following Markdown:

# Annotation test
  
  ```shell
  #!/bin/bash
  #
  # this is a multi-line comment
  # that goes on and on # (1)
  # and ends here
  
  echo "not a comment" # (2)
  echo "the end"
  ```
  
  1. first annotation
  2. second annotation

generates the following code block:
image

  • Annotation (1) is made on a commented line, and the marker is inserted as a new line in the block.
  • Annotation (2) is made on a regular, non-comment line, and the marker properly aligned.

Steps to reproduce

Activate code block annotations in Insiders, and generated a code block with an annotation on a language-commented line.

Package versions

  • Python: Python 3.9.7
  • MkDocs: mkdocs, version 1.2.3
  • Material: Version: 7.3.4+insiders.3.1.4

Configuration

theme:
  features:
    - content.code.annotate

System information

  • Operating system: Linux
  • Browser: Chrome

Metadata

Assignees

No one assigned

    Labels

    bugIssue reports a bugresolvedIssue is resolved, yet unreleased if open

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions