MyST-Parser icon indicating copy to clipboard operation
MyST-Parser copied to clipboard

`smartquotes` extension doesn't honor localized rules

Open dbitouze opened this issue 2 years ago • 0 comments

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:

  • enabled,"Test" is converted into “Test”,
  • disabled, "Test" is converted into « Test ».

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"

dbitouze avatar Sep 07 '23 19:09 dbitouze