Skip to content

SuperFences and CodeHilite problem #1604

Closed
@tjapro

Description

@tjapro

I checked that...

  • ... the documentation does not mention anything about my problem
  • ... the problem doesn't occur with the default MkDocs template
  • ... the problem is not in any of my customizations (CSS, JS, template)
  • ... there are no open or closed issues that are related to my problem

Description

I have a Mkdocs project with CodeHilite and SuperFences.
I notice that CodeHilite doesn't show anymore the line numbers (it is true globally).
So I remove one by one the extensions and plugins and discover that SuperFences somehow disables the line numbers.

See facelessuser/pymdown-extensions#893

A solution: an alert in documentation like "SuperFences is incompatible with CodeHilite; use Highlight instead".

PS: I made a test with SuperFences and Highlight and worked as expected.
Actual .yml:

...
  - pymdownx.highlight:
      linenums:          true
...

Expected behavior

In this case an alert in documentation.

Actual behavior

No alert.

Steps to reproduce the bug

  1. Add Super Fences and CodeHilite (activate the linenums in CodeHilite)
  2. Write some code inside ```
  3. No linenums appear.

Package versions

  • Python: Python 3.7.6
  • MkDocs: mkdocs, version 1.1
  • Material: Version: 5.1.0

Project configuration

...

# Configuration
theme:
  name:                  material
  custom_dir:            theme/
  language:              en
  features:
    - instant
    - tabs
  palette:
    primary:             black
    accent:              blue
  font:
    text:                Roboto
    code:                Fira Code
  logo:                  assets/img/logo/logo.svg
  favicon:               assets/img/logo/favicon.ico

...

# Extensions / Plugins
markdown_extensions:
  - admonition # notes make pretty
  - footnotes
  - meta # page-specific context
  - toc:
      permalink:         true # inserts an anchor
  - sane_lists # better ul and ol
  - nl2br # newline hard break
  - pymdownx.betterem:   # better italic and bold
      smart_enable:      asterisk
  - pymdownx.caret # insert text and superscript
  - pymdownx.details # details and summary; work with admonition
  - pymdownx.emoji:
      emoji_index:       !!python/name:pymdownx.emoji.twemoji
      emoji_generator:   !!python/name:pymdownx.emoji.to_svg
  - pymdownx.highlight:  # better code, instead of CodeHilite           <--------
      linenums:          true
  - pymdownx.inlinehilite # like codehilite but inline
  - pymdownx.magiclink # auto links
  - pymdownx.mark # highlight text
  - pymdownx.smartsymbols # special symbols
  - pymdownx.superfences: # nest code blocks under other blocks   <-------
  - pymdownx.tasklist:   # better tasks lists
      custom_checkbox:   true
  - pymdownx.tabbed # auto tabs
  - pymdownx.tilde # strike through cross out text

plugins:
  - search:
      prebuild_index:    true
  - localsearch:
      promise_delay:     100
  - minify:
      minify_html:       true
      htmlmin_opts:
        remove_comments: true
  - git-revision-date-localized
  - autolinks # for relative links to docs files
  - progress # to show the rendered files in console

System information

  • OS: Fedora 31
  • Browser: Google Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions