executablebooks / MyST-Parser

An extended commonmark compliant parser, with bridges to docutils/sphinx
https://myst-parser.readthedocs.io
MIT License
736 stars 195 forks source link

`smartquotes` extension doesn't honor localized rules #806

Open dbitouze opened 1 year ago

dbitouze commented 1 year ago

What version of myst-parser are you using?

2.0.0

What version dependencies are you using?

sphinx

What operating system are you using?

Linux

Describe the Bug

When the MyST's extension smartquotes is enabled, e.g. the double quotes are automatically converted to their opening/closing variants, but only in their English form, whatever the language specified in the conf.py file.

More specifically, with language=fr in conf.py and the MyST's extension smartquotes:

Expected Behavior

The MyST's extension smartquotes should honor localized rules.

To Reproduce

Create a minimal Sphinx documentation project, with the following conf.py file:

# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'Test smartquotes'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

source_suffix = ['.rst', '.md']

# smartquotes = True

extensions = [
    'myst_parser',
]

myst_enable_extensions = [
    # "smartquotes",
]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

language = 'fr'

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'alabaster'
html_static_path = ['_static']

and the following index.md file:

# Welcome to Test's documentation!

"Test"