U
    Sh                     @  s   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z! ddl"m#Z# ddl$m%Z% ddddddZ&dS )z]This module holds the ``create_md_parser`` function,
which creates a parser from the config.
    )annotations)Callable)
MarkdownIt)RendererProtocol)amsmath_plugin)attrs_block_pluginattrs_plugin)colon_fence_plugin)deflist_plugin)dollarmath_plugin)fieldlist_plugin)footnote_plugin)front_matter_plugin)myst_block_plugin)myst_role_plugin)substitution_plugin)tasklists_plugin)wordcount_plugin)MdParserConfigr   z(Callable[[MarkdownIt], RendererProtocol]r   )configrendererreturnc                 C  s  | j r2td|djt| jd}|jd| i |S | jrtd|dddjt	| j
ddjt| jd}|jd	| d
 |S td|ddttttjt| jddd}d}d| jkr|d d	}d| jkr|d d	}d| jkr.|d |jdk	r.|jd| ji d| jkrD|d d| jkrl|jt| j| j| j| jd d| jkr|t d| jkr|t d| jkr|t d| jkr|t d| jkr|jt	| j
d d| jkr|jtf| j  d| jkr|jtdd	dd nd| jkr8|jtdd  d!| jkrN|t  | j!D ]}||d	 qT|j|d| jk| d" |S )#z>Return a Markdown parser with the required MyST configuration.Z
commonmark)Zrenderer_cls)Z
per_minutemyst_configZstrikethroughtable)enabledlinkifyT)r   r   Zfootnote_inlineZfootnote_tailFZsmartquotesZreplacementsNZ
fuzzy_linkZ
dollarmath)Zallow_labelsZallow_spaceZallow_digitsZdouble_inlineZcolon_fenceZamsmathZdeflistZ	fieldlistZtasklistZsubstitutionZattrs_inline)imageZcode_inlineZ
link_closeZ
span_closeZfootnote_ref)afterspansZ
span_afterZattrs_image)r   )r   Zattrs_block)typographerr   r   )"Zcommonmark_onlyr   Zuser   Zwords_per_minuteoptionsupdateZgfm_onlyenabler   Zenable_checkboxesr   r   r   r   disableZenable_extensionsr   setZlinkify_fuzzy_linksr   Zdmath_allow_labelsZdmath_allow_spaceZdmath_allow_digitsZdmath_double_inliner	   r   r
   r   r   Zsub_delimitersr   r   Zdisable_syntax)r   r   mdr   name r'   K/root/rtd-docs/venv/lib/python3.8/site-packages/myst_parser/parsers/mdit.pycreate_md_parser   s       	 	











r)   N)'__doc__
__future__r   typingr   Zmarkdown_itr   Zmarkdown_it.rendererr   Zmdit_py_plugins.amsmathr   Zmdit_py_plugins.attrsr   r   Zmdit_py_plugins.colon_fencer	   Zmdit_py_plugins.deflistr
   Zmdit_py_plugins.dollarmathr   Zmdit_py_plugins.field_listr   Zmdit_py_plugins.footnoter   Zmdit_py_plugins.front_matterr   Zmdit_py_plugins.myst_blocksr   Zmdit_py_plugins.myst_roler   Zmdit_py_plugins.substitutionr   Zmdit_py_plugins.tasklistsr   Zmdit_py_plugins.wordcountr   Zmyst_parser.config.mainr   r)   r'   r'   r'   r(   <module>   s&   