%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/markdown_it/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/markdown_it/__pycache__/main.cpython-312.pyc

�

'W�d�1���UddlmZddlmZmZmZmZmZddlm	Z	ddl
mZmZm
Z
ddlmZmZddlmZmZddlmZdd	lmZdd
lmZddlmZmZddlmZdd
lm Z ddlm!Z!m"Z"m#Z#m$Z$	ddl%Z%ejNjQ�ejRjQ�ejTjQ�ejVjQ�ejXjQ�d�Z-de.d<Gd�d�Z/y#e&$rdZ%Y��wxYw)�)�annotations)�Callable�	Generator�Iterable�Mapping�MutableMapping)�contextmanager)�Any�Literal�overload�)�helpers�presets)�
normalize_url�utils)�ParserBlock)�
ParserCore)�ParserInline)�RendererHTML�RendererProtocol)�	StateCore)�Token)�EnvType�OptionsDict�OptionsType�
PresetTypeN)�defaultz
js-default�zero�
commonmarkzgfm-likezdict[str, PresetType]�_PRESETSc�r�eZdZ		ded�					dd�Zdd�Zedd��Zedd��Zed d��Zed!d��Zed"d	��Zd"d
�Zd#d�Z	d$					d%d�Z	d&d
�Z
d&d�Z	d'					d(d�Z	d'					d(d�Z
ed)d��Z	d*							d+d�Z								d,d�Zd$d-d�Zd$d.d�Zd$d-d�Zd$d.d�Zd/d�Zd0d�Zd1d�Zy)2�
MarkdownItN)�renderer_clsc�N�t|_t|_t�|_t	�|_t
�|_||�|_trtj�nd|_|rt|t�std|�d���|j||��y)a6Main parser class

        :param config: name of configuration to load or a pre-defined dictionary
        :param options_update: dictionary that will be merged into ``config["options"]``
        :param renderer_cls: the class to load as the renderer:
            ``self.renderer = renderer_cls(self)
        Nz$options_update should be a mapping: z4
(Perhaps you intended this to be the renderer_cls?))�options_update)rrr�inliner�blockr�core�renderer�
linkify_it�	LinkifyIt�linkify�
isinstancer�	TypeError�	configure)�self�configr%r#s    �2/usr/lib/python3/dist-packages/markdown_it/main.py�__init__zMarkdownIt.__init__!s�����
����#�n��� �]��
��L��	�$�T�*��
�1;�z�+�+�-�����*�^�W�"E��6�~�6F�G�H��
�	
���v�n��=�c�b�|jj�d|jj�d�S)N�.z())�	__class__�
__module__�__name__)r0s r2�__repr__zMarkdownIt.__repr__Cs+���.�.�+�+�,�A�d�n�n�.E�.E�-F�b�I�Ir4c��y�N��r0�names  r2�__getitem__zMarkdownIt.__getitem__F���r4c��yr<r=r>s  r2r@zMarkdownIt.__getitem__JrAr4c��yr<r=r>s  r2r@zMarkdownIt.__getitem__NrAr4c��yr<r=r>s  r2r@zMarkdownIt.__getitem__RrAr4c��yr<r=r>s  r2r@zMarkdownIt.__getitem__VrAr4c�f�|j|j|j|jd�|S)N�r&r'r(r)rGr>s  r2r@zMarkdownIt.__getitem__Zs2���k�k��Z�Z��I�I��
�
�	
�
��	r4c�$�t|�|_y)a�Set parser options (in the same format as in constructor).
        Probably, you will never need it, but you can change options after constructor call.

        __Note:__ To achieve the best possible performance, don't modify a
        `markdown-it` instance options on the fly. If you need multiple configurations
        it's best to create multiple instances and initialize each with separate config.
        N)r�options)r0rIs  r2�setzMarkdownIt.setbs��#�7�+��r4c���t|t�r!|tvrtd|�d���t|}n|}|st	d��|jdi�xsi}|ri|�|�}|j
|�d|vr�|dj�D]j\}}|jdd�}|r||jj|�|jdd�}|s�M||jj|��l|S)	a�Batch load of all options and component settings.
        This is an internal method, and you probably will not need it.
        But if you will - see available presets and data structure
        [here](https://github.com/markdown-it/markdown-it/tree/master/lib/presets)

        We strongly recommend to use presets instead of direct config loads.
        That will give better compatibility with next versions.
        zWrong `markdown-it` preset 'z
', check namez*Wrong `markdown-it` config, can't be emptyrI�
components�rulesN�rules2)r-�strr �KeyError�
ValueError�getrJ�items�ruler�
enableOnly�ruler2)	r0rr%r1rIr?�	componentrMrNs	         r2r/zMarkdownIt.configurels���g�s�#��h�&��!=�g�Y�m�T�U�U��g�&�F��F���I�J�J��*�*�Y��+�1�r���3��3�N�3�G�������6�!�#)�,�#7�#=�#=�#?�
9���i�!�
�
�g�t�4�����J�$�$�/�/��6�"���x��6�����J�%�%�0�0��8�

9��r4c��dD�cic] }|||jj���"}}|jjj�|d<|Scc}w�z%Return the names of all active rules.�r(r'r&�inline2)rT�
get_all_rulesr&rV�r0�chainrMs   r2r\zMarkdownIt.get_all_rules�sb��5�
��
�4��;�$�$�2�2�4�4�
��
� �;�;�-�-�;�;�=��i�����
��%Ac��dD�cic] }|||jj���"}}|jjj�|d<|Scc}wrY)rT�get_active_rulesr&rVr]s   r2razMarkdownIt.get_active_rules�sb��5�
��
�4��;�$�$�5�5�7�7�
��
� �;�;�-�-�>�>�@��i�����
r_c�Z�g}t|t�r|g}dD]0}|j||jj	|d���2|j|j
jj	|d��|D�cgc]	}||vs�|��}}|r|std|����|Scc}w)a�Enable list or rules. (chainable)

        :param names: rule name or list of rule names to enable.
        :param ignoreInvalid: set `true` to ignore errors when rule not found.

        It will automatically find appropriate components,
        containing rules with given names. If rule not found, and `ignoreInvalid`
        not set - throws exception.

        Example::

            md = MarkdownIt().enable(['sub', 'sup']).disable('smartquotes')

        rZTz.MarkdownIt. Failed to enable unknown rule(s): )r-rO�extendrT�enabler&rVrQ�r0�names�
ignoreInvalid�resultr^r?�misseds       r2rdzMarkdownIt.enable�s���"���e�S�!��G�E�0�	A�E��M�M�$�u�+�+�+�2�2�5�$�?�@�	A��
�
�d�k�k�(�(�/�/��t�<�=�#(�?�4�D��,>�$�?��?��-��M�f�X�V�W�W����	@��	B(�B(c�Z�g}t|t�r|g}dD]0}|j||jj	|d���2|j|j
jj	|d��|D�cgc]	}||vs�|��}}|r|std|����|Scc}w)z�The same as [[MarkdownIt.enable]], but turn specified rules off. (chainable)

        :param names: rule name or list of rule names to disable.
        :param ignoreInvalid: set `true` to ignore errors when rule not found.

        rZTz/MarkdownIt. Failed to disable unknown rule(s): )r-rOrcrT�disabler&rVrQres       r2rlzMarkdownIt.disable�s������e�S�!��G�E�0�	B�E��M�M�$�u�+�+�+�3�3�E�4�@�A�	B��
�
�d�k�k�(�(�0�0���=�>�#(�?�4�D��,>�$�?��?��-��N�v�h�W�X�X����@rjc#�K�|j�}d��|j�D])\}}|dk7s�||jj|��+|jj
j|d�y�w)zEA context manager, that will reset the current enabled rules on exit.Nr[)rarSrTrUr&rV)r0�chain_rulesr^rMs    r2�reset_ruleszMarkdownIt.reset_rules�st�����+�+�-��
�'�-�-�/�	4�L�E�5��	�!��U��!�!�,�,�U�3�	4�	
�����%�%�k�)�&<�=�s�0A<�A	A<c��|jj|k(r3|j|j�|jj|<yy)ztAdd a rule for rendering a particular Token type.

        Only applied when ``renderer.__output__ == fmt``
        N)r)�
__output__�__get__rM)r0r?�function�fmts    r2�add_render_rulezMarkdownIt.add_render_rule�s>���=�=�#�#�s�*�(0�(8�(8����(G�D�M�M����%�+r4c��||g|��i|��|S)aoLoad specified plugin with given params into current parser instance. (chainable)

        It's just a sugar to call `plugin(md, params)` with curring.

        Example::

            def func(tokens, idx):
                tokens[idx].content = tokens[idx].content.replace('foo', 'bar')
            md = MarkdownIt().use(plugin, 'foo_replace', 'text', func)

        r=)r0�plugin�paramsrIs    r2�usezMarkdownIt.use�s��	�t�(�f�(��(��r4c��|�in|}t|t�stdt|�����t|t�stdt|�����t|||�}|jj|�|jS)a.Parse the source string to a token stream

        :param src: source string
        :param env: environment sandbox

        Parse input string and return list of block tokens (special token type
        "inline" will contain list of inline tokens).

        `env` is used to pass data between "distributed" rules and return additional
        metadata like reference info, needed for the renderer. It also can be used to
        inject data in specific cases. Usually, you will be ok to pass `{}`,
        and then pass updated object to renderer.
        z+Input data should be a MutableMapping, not �#Input data should be a string, not )	r-rr.�typerOrr(�process�tokens�r0�src�env�states    r2�parsezMarkdownIt.parses{���K�b�S���#�~�.��I�$�s�)��U�V�V��#�s�#��A�$�s�)��M�N�N��#�t�S�)���	�	���%� ��|�|�r4c�|�|�in|}|jj|j||�|j|�S)a}Render markdown string into html. It does all magic for you :).

        :param src: source string
        :param env: environment sandbox
        :returns: The output of the loaded renderer

        `env` can be used to inject additional metadata (`{}` by default).
        But you will not need it with high probability. See also comment
        in [[MarkdownIt.parse]].
        )r)�renderr�rI�r0r�r�s   r2r�zMarkdownIt.renders7���K�b�S���}�}�#�#�D�J�J�s�C�$8�$�,�,��L�Lr4c� �|�in|}t|t�stdt|�����t|t�stdt|�����t|||�}d|_|jj|�|jS)a=The same as [[MarkdownIt.parse]] but skip all block rules.

        :param src: source string
        :param env: environment sandbox

        It returns the
        block tokens list with the single `inline` element, containing parsed inline
        tokens in `children` property. Also updates `env` object.
        z,Input data should be an MutableMapping, not r{T)
r-rr.r|rOr�
inlineModer(r}r~rs    r2�parseInlinezMarkdownIt.parseInline%s����K�b�S���#�~�.��J�4�PS�9�+�V�W�W��#�s�#��A�$�s�)��M�N�N��#�t�S�)������	�	���%� ��|�|�r4c�|�|�in|}|jj|j||�|j|�S)aSimilar to [[MarkdownIt.render]] but for single paragraph content.

        :param src: source string
        :param env: environment sandbox

        Similar to [[MarkdownIt.render]] but for single paragraph content. Result
        will NOT be wrapped into `<p>` tags.
        )r)r�r�rIr�s   r2�renderInlinezMarkdownIt.renderInline9s9���K�b�S���}�}�#�#�D�$4�$4�S�#�$>����c�R�Rr4c�,�tj|�S)a'Validate if the URL link is allowed in output.

        This validator can prohibit more than really needed to prevent XSS.
        It's a tradeoff to keep code simple and to be secure by default.

        Note: the url should be normalized at this point, and existing entities decoded.
        )r�validateLink�r0�urls  r2r�zMarkdownIt.validateLinkGs���)�)�#�.�.r4c�,�tj|�S)z�Normalize destination URLs in links

        ::

            [label]:   destination   'title'
                    ^^^^^^^^^^^
        )r�
normalizeLinkr�s  r2r�zMarkdownIt.normalizeLinkQs���*�*�3�/�/r4c�,�tj|�S)zbNormalize autolink content

        ::

            <destination>
            ~~~~~~~~~~~
        )r�normalizeLinkText)r0�links  r2r�zMarkdownIt.normalizeLinkText[s���.�.�t�4�4r4)rN)r1�str | PresetTyper%�Mapping[str, Any] | Noner#z(Callable[[MarkdownIt], RendererProtocol])�returnrO)r?zLiteral['inline']r�r)r?zLiteral['block']r�r)r?zLiteral['core']r�r)r?zLiteral['renderer']r�r)r?rOr�r
)rIrr��Noner<)rr�r%r�r�r")r�zdict[str, list[str]])F)rfzstr | Iterable[str]rg�boolr�r")r�zGenerator[None, None, None])�html)r?rOrszCallable[..., Any]rtrOr�r�)rwzCallable[..., None]rxr
rIr
r�r")r�rOr��EnvType | Noner�zlist[Token])r�rOr�r�r�r
)r�rOr�r�)r�rOr�rO)r�rOr�rO)r9r8�__qualname__rr3r:rr@rJr/r\rardrlr	roruryr�r�r�r�r�r�r�r=r4r2r"r" s���$0�37� >�
BN� >� � >�1� >�
?� >�DJ����������������������,�UY�$�'�$�9Q�$�	�$�L��AF��(��9=��	��BAF��(��9=��	��.�>��>�CI�H��H�#5�H�<?�H�	
�H��)��47��DG��	��"�.M��(
S�/�0�5r4r")0�
__future__r�collections.abcrrrrr�
contextlibr	�typingr
rr�rr�commonrr�parser_blockr�parser_corer�
parser_inlinerr)rr�rules_core.state_corer�tokenrrrrrr*�ModuleNotFoundErrorr�make�
js_defaultrr�gfm_liker �__annotations__r"r=r4r2�<module>r�s���"�R�R�%�)�)��(�%�#�'�4�,��@�@������#�#�%��$�$�)�)�+��L�L�����$�$�)�)�+�� � �%�%�'�#��
��C5�C5�����J��s�)C=�=D�D

Zerion Mini Shell 1.0