Skip to content

Native directive params support #55

@mvorisek

Description

@mvorisek

I am migrating sphinx docs from .rst to .md.

Rst file:

.. php:method:: add($object, $region = 'Content')

    Bla bla

    :param $object: Xxx

Md/MyST file:

:::{php:method} add($object, $region = 'Content')
:param $region: Xxx

Bla Bla

:param $object: Xxx
:::

Currently the output looks like:
image

Notice, the native MyST param is missing/ignored and the 2nd param not parsed [1]/formated. I think the problem is sphinxcontrib-phpdomain extension tries to parse the params from rst text directly instead of supporting directive/AST params directly.

[1] MyST spec https://myst-parser.readthedocs.io/en/latest/syntax/roles-and-directives.html#parameterizing-directive - directives are parsed at the directive start only

I would expect sphinxcontrib-phpdomain extension to honor natively parsed directive parameters.

Sphinx build log:

C:\Users\Administrator\Desktop\md\docs\view.md:46: WARNING: 'php:method': Unknown option keys: ['param $region']
    (allowed: ['module', 'nocontentsentry', 'noindex', 'noindexentry']) [myst.directive_parse]

To reproduce this issue, edit any rst sphinx project like:

conf.py:

 extensions = [
     'sphinx.ext.autodoc',
     'sphinx.ext.intersphinx',
     'sphinx.ext.todo',
     'sphinx.ext.coverage',
     'sphinxcontrib.phpdomain',
+    'myst_parser',
 ]

+myst_enable_extensions = ['colon_fence']

requirements.txt

 sphinx<5
 sphinx-rtd-theme
 sphinxcontrib-phpdomain
+myst-parser

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