o
    tf                     @   sL   g d Z dZdZdd Zdd Zdd Zd	d
 Zdd Zdd Zdd Z	dS ))mathmath_in_quotemath_in_listz7^ {0,3}\$\$[ \t]*\n(?P<math_text>[\s\S]+?)\n\$\$[ \t]*$z"\$(?!\s)(?P<math_text>.+?)(?!\s)\$c                 C   s&   | d}|d|d | d S )N	math_text
block_mathtyperaw   groupZappend_tokenend)blockmstatetext r   ]/var/www/html/software/conda/envs/catlas/lib/python3.10/site-packages/mistune/plugins/math.pyparse_block_math   s   
r   c                 C   s"   | d}|d|d | S )Nr   inline_mathr   r
   )inliner   r   r   r   r   r   parse_inline_math   s   
r   c                 C      d| d S )Nz<div class="math">$$
z

$$</div>
r   rendererr   r   r   r   render_block_math      r   c                 C   r   )Nz<span class="math">\(z	\)</span>r   r   r   r   r   render_inline_math   r   r   c                 C   sb   | j jdttdd | jjdttdd | jr-| jjdkr/| jdt	 | jdt
 dS dS dS )a'  A mistune plugin to support math. The syntax is used
    by many markdown extensions:

    .. code-block:: text

        Block math is surrounded by $$:

        $$
        f(a)=f(b)
        $$

        Inline math is surrounded by `$`, such as $f(a)=f(b)$

    :param md: Markdown instance
    r   listbeforer   linkhtmlN)r   registerBLOCK_MATH_PATTERNr   r   INLINE_MATH_PATTERNr   r   NAMEr   r   mdr   r   r   r      s   r   c                 C      | j j| j jddd dS )z(Enable block math plugin in block quote.r   r   r   N)r   insert_ruleZblock_quote_rulesr&   r   r   r   r   2      r   c                 C   r(   )z!Enable block math plugin in list.r   r   r   N)r   r)   Z
list_rulesr&   r   r   r   r   7   r*   r   N)
__all__r#   r$   r   r   r   r   r   r   r   r   r   r   r   <module>   s    