576 |
576 |
577 if Preferences.getEditor("PreviewMarkdownNLtoBR"): |
577 if Preferences.getEditor("PreviewMarkdownNLtoBR"): |
578 extensions.append("nl2br") |
578 extensions.append("nl2br") |
579 |
579 |
580 pyMdown = False |
580 pyMdown = False |
581 if Preferences.getEditor("PreviewMarkdownUsePyMdownExtensions"): |
581 if Preferences.getEditor("PreviewMarkdownUsePyMdownExtensions") and bool( |
582 with contextlib.suppress(ImportError): |
582 importlib.util.find_spec("pymdownx") |
583 import pymdownx # __IGNORE_EXCEPTION__ __IGNORE_WARNING__ |
583 ): |
584 |
584 # PyPI package is 'pymdown-extensions' |
585 # PyPI package is 'pymdown-extensions' |
585 extensions.extend( |
586 |
586 [ |
587 extensions.extend( |
587 "toc", |
588 [ |
588 "pymdownx.extra", |
589 "toc", |
589 "pymdownx.caret", |
590 "pymdownx.extra", |
590 "pymdownx.emoji", |
591 "pymdownx.caret", |
591 "pymdownx.mark", |
592 "pymdownx.emoji", |
592 "pymdownx.tilde", |
593 "pymdownx.mark", |
593 "pymdownx.keys", |
594 "pymdownx.tilde", |
594 "pymdownx.tasklist", |
595 "pymdownx.keys", |
595 "pymdownx.smartsymbols", |
596 "pymdownx.tasklist", |
596 ] |
597 "pymdownx.smartsymbols", |
597 ) |
598 ] |
598 pyMdown = True |
599 ) |
|
600 pyMdown = True |
|
601 |
599 |
602 if not pyMdown: |
600 if not pyMdown: |
603 extensions.extend(["extra", "toc"]) |
601 extensions.extend(["extra", "toc"]) |
604 |
602 |
605 # version 2.0 supports only extension names, not instances |
603 # version 2.0 supports only extension names, not instances |