o
    %if7f                     @  s  d dl mZ d dlZd dlmZmZmZmZmZm	Z	m
Z
 d dlmZ d dlmZ ejdkr4d dlmZ n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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*m+Z+ d	dl,m-Z- d	dl.m/Z/m0Z0 G dd dZ1G dd de1Z2G dd de1Z3G dd de3Z4G dd de3Z5G d d! d!e3Z6G d"d# d#e3Z7G d$d% d%e1Z8G d&d' d'e1Z9G d(d) d)e1Z:G d*d+ d+e1Z;G d,d- d-e1Z<G d.d/ d/e1Z=G d0d1 d1e1Z>G d2d3 d3e3Z?G d4d5 d5e3Z@G d6d7 d7e3ZAG d8d9 d9ZBG d:d; d;e"ZCeDd<krd dlEZEd dlZeEjFd=d>ZGeGjHd?d@dAdB eGjHdCdDdEdFddGdH eGjHdIdJdKdLdMdN eGjHdOdPdQddQdN eGjHdRdSdTdFdUdV eGjHdWdXeIdYddZd[ eGjHd\d]d^dFd_dV eGjHd`dadbdFdcdV eGJ ZKd ddlLmZ eKjMdekrejNO ZPneQeKjMdfdgdhZReRO ZPW d   n	1 sw   Y  eCePeKjSrdindjeKjTeKjUeKjVdkZWeKjXrd dlYZYd dlZZZeY[ Z\ee\eKj]eKj^dlZe_eW eZ`e\a  dS eeKj]eKj^dmdnZe_eW dS dS )o    )annotationsN)ClassVarDictIterableListOptionalTypeUnion)
MarkdownIt)Token)      )get_args)Table   box)
loop_first)Stack)ConsoleConsoleOptionsJustifyMethodRenderResult)Renderables)JupyterMixin)Panel)Rule)Segment)Style
StyleStack)Syntax)TextTextTypec                   @  sZ   e Zd ZU dZded< ed#d
dZd$ddZd%ddZd$ddZ	d&ddZ
d'd d!Zd"S )(MarkdownElementTzClassVar[bool]new_linemarkdown
'Markdown'tokenr   return'MarkdownElement'c                 C  s   |  S )zFactory to create markdown element,

        Args:
            markdown (Markdown): The parent Markdown object.
            token (Token): A node from markdown-it.

        Returns:
            MarkdownElement: A new markdown element
         clsr%   r'   r*   r*   F/var/www/html/corbot_env/lib/python3.10/site-packages/rich/markdown.pycreate!   s   zMarkdownElement.createcontext'MarkdownContext'Nonec                 C     dS )zuCalled when the node is entered.

        Args:
            context (MarkdownContext): The markdown context.
        Nr*   selfr/   r*   r*   r-   on_enter.       zMarkdownElement.on_entertextr"   c                 C  r2   )zpCalled when text is parsed.

        Args:
            context (MarkdownContext): The markdown context.
        Nr*   r4   r/   r7   r*   r*   r-   on_text5   r6   zMarkdownElement.on_textc                 C  r2   )zwCalled when the parser leaves the element.

        Args:
            context (MarkdownContext): [description]
        Nr*   r3   r*   r*   r-   on_leave<   r6   zMarkdownElement.on_leavechildboolc                 C  r2   )a|  Called when a child element is closed.

        This method allows a parent element to take over rendering of its children.

        Args:
            context (MarkdownContext): The markdown context.
            child (MarkdownElement): The child markdown element.

        Returns:
            bool: Return True to render the element, or False to not render the element.
        Tr*   r4   r/   r;   r*   r*   r-   on_child_closeC   s   zMarkdownElement.on_child_closeconsole	'Console'options'ConsoleOptions''RenderResult'c                 C  r2   )Nr*   r*   r4   r?   rA   r*   r*   r-   __rich_console__S   s   z MarkdownElement.__rich_console__Nr%   r&   r'   r   r(   r)   r/   r0   r(   r1   r/   r0   r7   r"   r(   r1   r/   r0   r;   r)   r(   r<   )r?   r@   rA   rB   r(   rC   )__name__
__module____qualname__r$   __annotations__classmethodr.   r5   r9   r:   r>   rE   r*   r*   r*   r-   r#      s   
 



r#   c                   @  s   e Zd ZdZdS )UnknownElementzAn unknown element.

    Hopefully there will be no unknown elements, and we will have a MarkdownElement for
    everything in the document.

    N)rJ   rK   rL   __doc__r*   r*   r*   r-   rO   Y   s    rO   c                   @  s2   e Zd ZdZdZdddZdddZdddZdS )TextElementz)Base class for elements that render text.noner/   r0   r(   r1   c                 C  s   | | j| _tdd| _d S Nleftjustify)enter_style
style_namestyler!   r7   r3   r*   r*   r-   r5   g   s   zTextElement.on_enterr7   r"   c                 C  s(   | j |t|tr|j d S d  d S N)r7   append
isinstancestrcurrent_styler8   r*   r*   r-   r9   k   s   (zTextElement.on_textc                 C  s   |   d S rZ   )leave_styler3   r*   r*   r-   r:   n      zTextElement.on_leaveNrG   rH   )rJ   rK   rL   rP   rX   r5   r9   r:   r*   r*   r*   r-   rQ   b   s    

rQ   c                   @  s@   e Zd ZU dZdZded< edddZdddZdddZ	dS )	ParagraphzA Paragraph.zmarkdown.paragraphr   rV   r%   r&   r'   r   r(   'Paragraph'c                 C  s   | |j pddS rS   rU   r+   r*   r*   r-   r.   x   s   zParagraph.creater1   c                 C  s
   || _ d S rZ   rU   r4   rV   r*   r*   r-   __init__|      
zParagraph.__init__r?   r   rA   r   r   c                 c  s    | j | j_ | jV  d S rZ   )rV   r7   rD   r*   r*   r-   rE      s   
zParagraph.__rich_console__N)r%   r&   r'   r   r(   rb   rV   r   r(   r1   r?   r   rA   r   r(   r   )
rJ   rK   rL   rP   rX   rM   rN   r.   rd   rE   r*   r*   r*   r-   ra   r   s   
 
ra   c                      sD   e Zd ZdZeddd	ZdddZd fddZdddZ  Z	S )Headingz
A heading.r%   r&   r'   r   r(   	'Heading'c                 C  s
   | |j S rZ   )tagr+   r*   r*   r-   r.      s   
zHeading.creater/   r0   r1   c                 C  s   t  | _|| j d S rZ   )r!   r7   rW   rX   r3   r*   r*   r-   r5      s   zHeading.on_enterrj   r]   c                   s    || _ d| | _t   d S )N	markdown.)rj   rX   superrd   )r4   rj   	__class__r*   r-   rd      s   zHeading.__init__r?   r   rA   r   r   c                 c  sL    | j }d|_| jdkrt|tjddV  d S | jdkr!tdV  |V  d S )Ncenterh1zmarkdown.h1.border)r   rY   h2 )r7   rV   rj   r   r   HEAVYr!   )r4   r?   rA   r7   r*   r*   r-   rE      s   



zHeading.__rich_console__)r%   r&   r'   r   r(   ri   rG   )rj   r]   r(   r1   rg   )
rJ   rK   rL   rP   rN   r.   r5   rd   rE   __classcell__r*   r*   rm   r-   rh      s    
rh   c                   @  s6   e Zd ZdZdZedd	d
ZdddZdddZdS )	CodeBlockz&A code block with syntax highlighting.zmarkdown.code_blockr%   r&   r'   r   r(   'CodeBlock'c                 C  s(   |j pd}|dd }| |pd|jS )Nrr    r   r7   )info	partition
code_theme)r,   r%   r'   	node_info
lexer_namer*   r*   r-   r.      s   
zCodeBlock.creater|   r]   themer1   c                 C  s   || _ || _d S rZ   )r|   r}   )r4   r|   r}   r*   r*   r-   rd         
zCodeBlock.__init__r?   r   rA   r   r   c                 c  s0    t | j }t|| j| jddd}|V  d S )NTr   )r}   	word_wrappadding)r]   r7   rstripr    r|   r}   )r4   r?   rA   codesyntaxr*   r*   r-   rE      s   
zCodeBlock.__rich_console__N)r%   r&   r'   r   r(   rv   )r|   r]   r}   r]   r(   r1   rg   )	rJ   rK   rL   rP   rX   rN   r.   rd   rE   r*   r*   r*   r-   ru      s    
ru   c                   @  s2   e Zd ZdZdZdddZdddZdddZdS )
BlockQuotezA block quote.zmarkdown.block_quoter(   r1   c                 C     t  | _d S rZ   r   elementsr4   r*   r*   r-   rd      r`   zBlockQuote.__init__r/   r0   r;   r)   r<   c                 C     | j | dS NFr   r[   r=   r*   r*   r-   r>         zBlockQuote.on_child_closer?   r   rA   r   r   c           	      c  sd    |j |jd d}|j| j|| jd}| j}td}td|}|D ]}|V  |E d H  |V  q"d S )N   widthrY   
u   ▌ )update	max_widthrender_linesr   rY   r   )	r4   r?   rA   render_optionslinesrY   r$   r   liner*   r*   r-   rE      s   

zBlockQuote.__rich_console__Nr(   r1   rI   rg   )rJ   rK   rL   rP   rX   rd   r>   rE   r*   r*   r*   r-   r      s    

r   c                   @  s   e Zd ZdZdZdd	d
ZdS )HorizontalRulez%A horizontal rule to divide sections.Fr?   r   rA   r   r(   r   c                 c  s     |j ddd}t|dV  d S )Nzmarkdown.hrrR   defaultr   )	get_styler   )r4   r?   rA   rY   r*   r*   r-   rE      s   zHorizontalRule.__rich_console__Nrg   )rJ   rK   rL   rP   r$   rE   r*   r*   r*   r-   r      s    r   c                   @  s.   e Zd ZdZdddZdddZdddZdS )TableElementz.MarkdownElement corresponding to `table_open`.r(   r1   c                 C  s   d | _ d | _d S rZ   )headerbodyr   r*   r*   r-   rd      r~   zTableElement.__init__r/   r0   r;   r)   r<   c                 C  s0   t |tr
|| _dS t |tr|| _dS td)Nz Couldn't process markdown table.F)r\   TableHeaderElementr   TableBodyElementr   RuntimeErrorr=   r*   r*   r-   r>      s   

zTableElement.on_child_closer?   r   rA   r   r   c                 c  s|    t tjd}| jd ur | jjd ur | jjjD ]}||j q| jd ur9| jj	D ]}dd |jD }|j
|  q)|V  d S )Nr   c                 S  s   g | ]}|j qS r*   )content).0elementr*   r*   r-   
<listcomp>  s    z1TableElement.__rich_console__.<locals>.<listcomp>)r   r   SIMPLE_HEAVYr   rowcells
add_columnr   r   rowsadd_row)r4   r?   rA   tablecolumnr   row_contentr*   r*   r-   rE      s   

zTableElement.__rich_console__Nr   rI   rg   )rJ   rK   rL   rP   rd   r>   rE   r*   r*   r*   r-   r      s
    

r   c                   @  $   e Zd ZdZdddZdddZdS )r   z@MarkdownElement corresponding to `thead_open` and `thead_close`.r(   r1   c                 C  s
   d | _ d S rZ   )r   r   r*   r*   r-   rd     re   zTableHeaderElement.__init__r/   r0   r;   r)   r<   c                 C  s   t |tsJ || _dS r   )r\   TableRowElementr   r=   r*   r*   r-   r>     s   z!TableHeaderElement.on_child_closeNr   rI   rJ   rK   rL   rP   rd   r>   r*   r*   r*   r-   r         
r   c                   @  r   )r   z@MarkdownElement corresponding to `tbody_open` and `tbody_close`.r(   r1   c                 C  
   g | _ d S rZ   )r   r   r*   r*   r-   rd     re   zTableBodyElement.__init__r/   r0   r;   r)   r<   c                 C     t |tsJ | j| dS r   )r\   r   r   r[   r=   r*   r*   r-   r>   !     zTableBodyElement.on_child_closeNr   rI   r   r*   r*   r*   r-   r     r   r   c                   @  r   )r   z:MarkdownElement corresponding to `tr_open` and `tr_close`.r(   r1   c                 C  r   rZ   )r   r   r*   r*   r-   rd   ,  re   zTableRowElement.__init__r/   r0   r;   r)   r<   c                 C  r   r   )r\   TableDataElementr   r[   r=   r*   r*   r-   r>   /  r   zTableRowElement.on_child_closeNr   rI   r   r*   r*   r*   r-   r   )  r   r   c                   @  s2   e Zd ZdZeddd	ZdddZdddZdS )r   z[MarkdownElement corresponding to `td_open` and `td_close`
    and `th_open` and `th_close`.r%   r&   r'   r   r(   r)   c                 C  s\   t |jdp	d}d|v rd}nd|v rd}n	d|v rd}nd	}|ttv s)J | |d
S )NrY   rr   ztext-align:rightrightztext-align:centerro   ztext-align:leftrT   r   rU   )r]   attrsgetr   r   )r,   r%   r'   rY   rV   r*   r*   r-   r.   ;  s   
zTableDataElement.createrV   r   r1   c                 C  s   t d|d| _|| _d S )Nrr   rU   )r!   r   rV   rc   r*   r*   r-   rd   L  s   
zTableDataElement.__init__r/   r0   r7   r"   c                 C  s2   t |tr	t|n|}||j | j| d S rZ   )r\   r]   r!   stylizer^   r   append_textr8   r*   r*   r-   r9   P  s   zTableDataElement.on_textNrF   rf   rH   )rJ   rK   rL   rP   rN   r.   rd   r9   r*   r*   r*   r-   r   7  s    
r   c                   @  s<   e Zd ZdZed dd	Zd!ddZd"ddZd#ddZdS )$ListElementzA list element.r%   r&   r'   r   r(   'ListElement'c                 C  s   | |j t|jddS )Nstartr   )typeintr   r   r+   r*   r*   r-   r.   Y  s   zListElement.create	list_typer]   
list_start
int | Noner1   c                 C  s   g | _ || _|| _d S rZ   )itemsr   r   )r4   r   r   r*   r*   r-   rd   ]  s   
zListElement.__init__r/   r0   r;   r)   r<   c                 C  r   r   )r\   ListItemr   r[   r=   r*   r*   r-   r>   b  r   zListElement.on_child_closer?   r   rA   r   r   c                 c  s    | j dkr| jD ]}|||E d H  q	d S | jd u rdn| j}|t| j }t| jD ]\}}||||| |E d H  q-d S )Nbullet_list_openr   )r   r   render_bulletr   len	enumeraterender_number)r4   r?   rA   itemnumberlast_numberindexr*   r*   r-   rE   i  s   

zListElement.__rich_console__N)r%   r&   r'   r   r(   r   )r   r]   r   r   r(   r1   rI   rg   )	rJ   rK   rL   rP   rN   r.   rd   r>   rE   r*   r*   r*   r-   r   V  s    

r   c                   @  s<   e Zd ZdZdZdddZdddZdddZdddZdS )r   zAn item in a list.zmarkdown.itemr(   r1   c                 C  r   rZ   r   r   r*   r*   r-   rd   }  r`   zListItem.__init__r/   r0   r;   r)   r<   c                 C  r   r   r   r=   r*   r*   r-   r>     r   zListItem.on_child_closer?   r   rA   r   r   c                 c  s    |j |jd d}|j| j|| jd}|jddd}td|}td|}td	}t|D ]\}	}
|	r5|n|V  |
E d H  |V  q-d S )
Nr   r   r   zmarkdown.item.bulletrR   r   u    • z   r   )r   r   r   r   rY   r   r   r   )r4   r?   rA   r   r   bullet_stylebulletr   r$   firstr   r*   r*   r-   r     s   


zListItem.render_bulletr   r   r   c                 c  s    t t|d }|j|j| d}|j| j|| jd}|jddd}td}	td| |}
t| 	|d	 d |}t
|D ]\}}|rG|n|
V  |E d H  |	V  q?d S )
N   r   r   zmarkdown.item.numberrR   r   r   rw   r   )r   r]   r   r   r   r   rY   r   r   rjustr   )r4   r?   rA   r   r   number_widthr   r   number_styler$   r   numeralr   r   r*   r*   r-   r     s   
zListItem.render_numberNr   rI   rg   )
r?   r   rA   r   r   r   r   r   r(   r   )	rJ   rK   rL   rP   rX   rd   r>   r   r   r*   r*   r*   r-   r   x  s    


r   c                   @  s$   e Zd ZedddZdddZdS )Linkr%   r&   r'   r   r(   r)   c                 C  s   |j dd}| |jt|S )Nhref#)r   r   r   r]   )r,   r%   r'   urlr*   r*   r-   r.     s   zLink.creater7   r]   r   c                 C  s   t || _|| _d S rZ   )r!   r7   r   )r4   r7   r   r*   r*   r-   rd     s   

zLink.__init__NrF   )r7   r]   r   r]   )rJ   rK   rL   rN   r.   rd   r*   r*   r*   r-   r     s    r   c                      sL   e Zd ZdZdZedd	d
Zd fddZd fddZd ddZ	  Z
S )!	ImageItemz#Renders a placeholder for an image.Fr%   r&   r'   r   r(   r)   c                 C  s   | t |jdd|jS )zFactory to create markdown element,

        Args:
            markdown (Markdown): The parent Markdown object.
            token (Any): A token from markdown-it.

        Returns:
            MarkdownElement: A new markdown element
        srcrr   )r]   r   r   
hyperlinksr+   r*   r*   r-   r.     s   zImageItem.createdestinationr]   r   r<   r1   c                   s    || _ || _d | _t   d S rZ   )r   r   linkrl   rd   )r4   r   r   rm   r*   r-   rd     s   zImageItem.__init__r/   r0   c                   s&   |j j| _tdd| _t | d S rS   )r^   r   r!   r7   rl   r5   r3   rm   r*   r-   r5     s   
zImageItem.on_enterr?   r   rA   r   r   c                 c  sf    t | jp	| jp	d d}| jpt| jdddd }| jr%|| tj	d|ddd}|V  d S )	Nr   /r   u   🌆 rw   rr   )end)
r   r   r   r7   r!   striprsplitr   r   assemble)r4   r?   rA   
link_styletitler7   r*   r*   r-   rE     s   "

zImageItem.__rich_console__rF   )r   r]   r   r<   r(   r1   rG   rg   )rJ   rK   rL   rP   r$   rN   r.   rd   r5   rE   rt   r*   r*   rm   r-   r     s    r   c                   @  sL   e Zd ZdZ		ddddZed ddZd!ddZd"ddZd ddZ	dS )#MarkdownContextz!Manages the console render state.Nmonokair?   r   rA   r   rY   r   inline_code_lexerOptional[str]inline_code_themer]   r(   r1   c                 C  sD   || _ || _t|| _t | _d | _|d ur td||d| _d S d S )Nrr   )r}   )r?   rA   r   style_stackr   stack_syntaxr    )r4   r?   rA   rY   r   r   r*   r*   r-   rd     s   
zMarkdownContext.__init__c                 C  s   | j jS )z>Current style which is the product of all styles on the stack.)r   currentr   r*   r*   r-   r^     s   zMarkdownContext.current_styler7   	node_typec                 C  s\   |dv r$| j dur$| j |}|  | jj| tj|| jj	d dS | jj| | dS )z#Called when the parser visits text.>   fencecode_inlineNr   )
r   	highlightr   r   topr9   r!   r   r   r   )r4   r7   r   highlight_textr*   r*   r-   r9     s   zMarkdownContext.on_textrX   Union[str, Style]c                 C  s"   | j j|dd}| j| | jS )zEnter a style context.rR   r   )r?   r   r   pushr^   )r4   rX   rY   r*   r*   r-   rW     s   zMarkdownContext.enter_stylec                 C  s   | j  }|S )zLeave a style context.)r   pop)r4   rY   r*   r*   r-   r_     s   
zMarkdownContext.leave_style)Nr   )r?   r   rA   r   rY   r   r   r   r   r]   r(   r1   )r(   r   )r7   r]   r   r]   r(   r1   )rX   r   r(   r   )
rJ   rK   rL   rP   rd   propertyr^   r9   rW   r_   r*   r*   r*   r-   r     s    

r   c                   @  s   e Zd ZU dZi dedededededede	d	e	d
e
dededededededeZded< h dZ						d4d5d'd(Zd6d+d,Zd7d2d3ZdS )8Markdowna  A Markdown renderable.

    Args:
        markup (str): A string containing markdown.
        code_theme (str, optional): Pygments theme for code blocks. Defaults to "monokai".
        justify (JustifyMethod, optional): Justify value for paragraphs. Defaults to None.
        style (Union[str, Style], optional): Optional style to apply to markdown.
        hyperlinks (bool, optional): Enable hyperlinks. Defaults to ``True``.
        inline_code_lexer: (str, optional): Lexer to use if inline code highlighting is
            enabled. Defaults to None.
        inline_code_theme: (Optional[str], optional): Pygments theme for inline code
            highlighting, or None for no highlighting. Defaults to None.
    paragraph_openheading_openr   
code_blockblockquote_openhrr   ordered_list_openlist_item_openimage
table_open
tbody_open
thead_opentr_opentd_openth_openz*ClassVar[Dict[str, Type[MarkdownElement]]]r   >   semr   strongr   NrR   Tmarkupr]   rz   rV   Optional[JustifyMethod]rY   r   r   r<   r   r   r   r(   r1   c           	      C  sP   t  dd}|| _||| _|| _|| _|| _|| _|| _	|p$|| _
d S )Nstrikethroughr   )r
   enabler  parseparsedrz   rV   rY   r   r   r   )	r4   r  rz   rV   rY   r   r   r   parserr*   r*   r-   rd   +  s   
zMarkdown.__init__tokensIterable[Token]c                 c  sL    |D ] }|j dk}|jdk}|jr |s |s | |jE dH  q|V  qdS )zFlattens the token stream.r   imgN)r   rj   children_flatten_tokens)r4   r  r'   is_fenceis_imager*   r*   r-   r  ?  s   

zMarkdown._flatten_tokensr?   r   rA   r   r   c                 c  sx   |j | jdd}|jdd}t|||| j| jd}| j}| j}d}t	 }| 
|D ]}	|	j}
|	j}|	jdk}|	jdk}|	jd	k}|
d
krO||	j|
 q+|
dkrZ|d|
 q+|
dkre|d|
 q+|
dkrt|	jdd}| jr|j ddd}|t|d7 }|| q+|jt| |	 q+|
dkr| jr|  q+|j }t|tsJ |j ddd}|| ||jj|
 |  |d|
 |j ddd}|| ||j|
 |  |d|
 q+||v r#|
dkr#|
dkr#|r|d|  q+|r|  q+|d|  |	jr||	j|
 |  q+| j |	jp,t!}|| |	}|s9|rD|j| |"| |rq|j }|j p\|jo\|jj#$||}|rp|rf|V  |%||j&E dH  n:|r|j  |	j}|dur||| |j p|jo|jj#$||}|r|r|V  |%||j&E dH  |s|r|'| |j(}q+dS )zRender markdown to the console.rR   r   N)height)r   r   Fr   r   r   r7   	hardbreakr   	softbreakrw   	link_openr   rr   zmarkdown.link_urlr   
link_closezmarkdown.linkz ()r   r   rk   ))r   rY   r   r   r   r   r  inlinesr   r   r  r   rj   nestingr9   r   r]   r   r   r   r   rW   r   r   r   r.   r_   r   r\   r7   plainr   r   rO   r5   r   r>   renderrA   r:   r$   )r4   r?   rA   rY   r/   r  inline_style_tagsr$   _new_line_segmentr'   r   rj   enteringexitingself_closingr   r   r   link_url_styleelement_classshould_renderr7   r*   r*   r-   rE   I  s   


















zMarkdown.__rich_console__)r   NrR   TNN)r  r]   rz   r]   rV   r  rY   r   r   r<   r   r   r   r   r(   r1   )r  r  r(   r  rg   )rJ   rK   rL   rP   ra   rh   ru   r   r   r   r   r   r   r   r   r   r   r   rM   r#  rd   r  rE   r*   r*   r*   r-   r     sZ   
 	


r   __main__z(Render Markdown to the console with Rich)descriptionpathPATHz%path to markdown file, or - for stdin)metavarhelpz-cz--force-colorforce_color
store_truezforce color for non-terminals)destactionr   r4  z-tz--code-themerz   r   zpygments code theme)r7  r   r4  z-iz--inline-code-lexerr   z-yz--hyperlinksr   zenable hyperlinks)r7  r8  r4  z-wz--widthr   z*width of output (default will auto-detect))r   r7  r   r4  z-jz	--justifyrV   zenable full text justifyz-pz--pagepagezuse pager to scroll output)r   -rtzutf-8)encodingfullrT   )rV   rz   r   r   )fileforce_terminalr   T)r?  r   record)b
__future__r   systypingr   r   r   r   r   r   r	   markdown_itr
   markdown_it.tokenr   version_infor   typing_extensions
rich.tabler   rr   r   _loopr   _stackr   r?   r   r   r   r   
containersr   jupyterr   panelr   ruler   segmentr   rY   r   r   r   r    r7   r!   r"   r#   rO   rQ   ra   rh   ru   r   r   r   r   r   r   r   r   r   r   r   r   r   rJ   argparseArgumentParserr  add_argumentr   
parse_argsargsrich.consoler1  stdinreadmarkdown_bodyopenmarkdown_filerV   rz   r   r   r%   r9  iopydocStringIOfileior5  r   printpagergetvaluer*   r*   r*   r-   <module>   s   $
;	##",(0 
;



