
    gr-                        U d dl mZ d dl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mZ er
d dlZd dlmZ d	Zd
ed<    G d d      Zy)    )annotations)TYPE_CHECKINGFinalcast)Markdown)gather_metrics)
clean_text)SupportsStris_sympy_expressionN)DeltaGeneratorz---r   #MARKDOWN_HORIZONTAL_RULE_EXPRESSIONc                     e Zd Z ed      	 ddd	 	 	 	 	 	 	 dd       Z ed      	 d	 	 	 	 	 dd       Z ed      	 ddd	 	 	 	 	 	 	 dd       Z ed	      dd	 	 	 	 	 dd
       Z ed      dd       Ze	dd       Z
y)MarkdownMixinmarkdownN)helpc                   t               }t        |      |_        ||_        t         j                  j
                  |_        |r||_        | j                  j                  d|      S )u9  Display string formatted as Markdown.

        Parameters
        ----------
        body : any
            The text to display as GitHub-flavored Markdown. Syntax
            information can be found at: https://github.github.com/gfm.
            If anything other than a string is passed, it will be converted
            into a string behind the scenes using ``str(body)``.

            This also supports:

            - Emoji shortcodes, such as ``:+1:``  and ``:sunglasses:``.
              For a list of all supported codes,
              see https://share.streamlit.io/streamlit/emoji-shortcodes.

            - Streamlit logo shortcode. Use ``:streamlit:`` to add a little
              Streamlit flair to your text.

            - A limited set of typographical symbols. ``"<- -> <-> -- >= <= ~="``
              becomes "← → ↔ — ≥ ≤ ≈" when parsed as Markdown.

            - Google Material Symbols (rounded style), using the syntax
              ``:material/icon_name:``, where "icon_name" is the name of the
              icon in snake case. For a complete list of icons, see Google's
              `Material Symbols <https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
              font library.

            - LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"
              must be on their own lines). Supported LaTeX functions are listed
              at https://katex.org/docs/supported.html.

            - Colored text and background colors for text, using the syntax
              ``:color[text to be colored]`` and ``:color-background[text to be colored]``,
              respectively. ``color`` must be replaced with any of the following
              supported colors: blue, green, orange, red, violet, gray/grey,
              rainbow, or primary. For example, you can use
              ``:orange[your text here]`` or ``:blue-background[your text here]``.
              If you use "primary" for color, Streamlit will use the default
              primary accent color unless you set the ``theme.primaryColor``
              configuration option.

        unsafe_allow_html : bool
            Whether to render HTML within ``body``. If this is ``False``
            (default), any HTML tags found in ``body`` will be escaped and
            therefore treated as raw text. If this is ``True``, any HTML
            expressions within ``body`` will be rendered.

            Adding custom HTML to your app impacts safety, styling, and
            maintainability.

            .. note::
                If you only want to insert HTML or CSS without Markdown text,
                we recommend using ``st.html`` instead.

        help : str or None
            A tooltip that gets displayed next to the Markdown. If this is
            ``None`` (default), no tooltip is displayed.

            The tooltip can optionally contain GitHub-flavored Markdown,
            including the Markdown directives described in the ``body``
            parameter of ``st.markdown``.

        Examples
        --------
        >>> import streamlit as st
        >>>
        >>> st.markdown("*Streamlit* is **really** ***cool***.")
        >>> st.markdown('''
        ...     :red[Streamlit] :orange[can] :green[write] :blue[text] :violet[in]
        ...     :gray[pretty] :rainbow[colors] and :blue-background[highlight] text.''')
        >>> st.markdown("Here's a bouquet &mdash;\
        ...             :tulip::cherry_blossom::rose::hibiscus::sunflower::blossom:")
        >>>
        >>> multi = '''If you end a line with two spaces,
        ... a soft return is used for the next line.
        ...
        ... Two (or more) newline characters in a row will result in a hard return.
        ... '''
        >>> st.markdown(multi)

        .. output::
           https://doc-markdown.streamlit.app/
           height: 350px

        r   )
MarkdownProtor	   body
allow_htmlTypeNATIVEelement_typer   dg_enqueue)selfr   unsafe_allow_htmlr   markdown_protos        P/var/www/openai/venv/lib/python3.12/site-packages/streamlit/elements/markdown.pyr   zMarkdownMixin.markdown!   sW    | '(.$5!&3&8&8&?&?#"&Nww
N;;    codec                    t               }d|xs d d| d}t        |      |_        t         j                  j                  |_        | j                  j                  d|      S )a+  Display a code block with optional syntax highlighting.

        (This is a convenience wrapper around `st.markdown()`)

        Parameters
        ----------
        body : str
            The string to display as code.

        language : str or None
            The language that the code is written in, for syntax highlighting.
            If ``None``, the code will be unstyled. Defaults to ``"python"``.

            For a list of available ``language`` values, see:

            https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/AVAILABLE_LANGUAGES_PRISM.MD

        Example
        -------
        >>> import streamlit as st
        >>>
        >>> code = '''def hello():
        ...     print("Hello, Streamlit!")'''
        >>> st.code(code, language="python")

        z``` 
z
```r   )r   r	   r   r   CODEr   r   r   )r   r   language
code_protor   s        r   r    zMarkdownMixin.code   s\    @ #_
R(4&6$X.
"/"4"4"9"9
ww
J77r   captionc                   t               }t        |      |_        ||_        d|_        t         j
                  j                  |_        |r||_        | j                  j                  d|      S )a  Display text in small font.

        This should be used for captions, asides, footnotes, sidenotes, and
        other explanatory text.

        Parameters
        ----------
        body : str
            The text to display as GitHub-flavored Markdown. Syntax
            information can be found at: https://github.github.com/gfm.

            See the ``body`` parameter of |st.markdown|_ for additional,
            supported Markdown directives.

            .. |st.markdown| replace:: ``st.markdown``
            .. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown

        unsafe_allow_html : bool
            Whether to render HTML within ``body``. If this is ``False``
            (default), any HTML tags found in ``body`` will be escaped and
            therefore treated as raw text. If this is ``True``, any HTML
            expressions within ``body`` will be rendered.

            Adding custom HTML to your app impacts safety, styling, and
            maintainability.

            .. note::
                If you only want to insert HTML or CSS without Markdown text,
                we recommend using ``st.html`` instead.

        help : str or None
            A tooltip that gets displayed next to the caption. If this is
            ``None`` (default), no tooltip is displayed.

            The tooltip can optionally contain GitHub-flavored Markdown,
            including the Markdown directives described in the ``body``
            parameter of ``st.markdown``.

        Examples
        --------
        >>> import streamlit as st
        >>>
        >>> st.caption("This is a string that explains something above.")
        >>> st.caption("A caption with _italics_ :blue[colors] and emojis :sunglasses:")

        Tr   )r   r	   r   r   
is_captionr   CAPTIONr   r   r   r   )r   r   r   r   caption_protos        r   r'   zMarkdownMixin.caption   s_    l &'-#4 #' %2%7%7%?%?"!%Mww
M::r   latexc                  t        |      rddl} |j                  |      }t               }dt	        |      z  |_        t        j                  j                  |_        |r||_	        | j                  j                  d|      S )a  Display mathematical expressions formatted as LaTeX.

        Supported LaTeX functions are listed at
        https://katex.org/docs/supported.html.

        Parameters
        ----------
        body : str or SymPy expression
            The string or SymPy expression to display as LaTeX. If str, it's
            a good idea to use raw Python strings since LaTeX uses backslashes
            a lot.

        help : str or None
            A tooltip that gets displayed next to the LaTeX expression. If
            this is ``None`` (default), no tooltip is displayed.

            The tooltip can optionally contain GitHub-flavored Markdown,
            including the Markdown directives described in the ``body``
            parameter of ``st.markdown``.

        Example
        -------
        >>> import streamlit as st
        >>>
        >>> st.latex(r'''
        ...     a + ar + a r^2 + a r^3 + \cdots + a r^{n-1} =
        ...     \sum_{k=0}^{n-1} ar^k =
        ...     a \left(\frac{1-r^{n}}{1-r}\right)
        ...     ''')

        r   Nz$$
%s
$$r   )r   sympyr,   r   r	   r   r   LATEXr   r   r   r   )r   r   r   r.   latex_protos        r   r,   zMarkdownMixin.latex   so    P t$5;;t$D#o'*T*::#0#5#5#;#; #Kww
K88r   dividerc                    t               }t        |_        t         j                  j                  |_        | j                  j                  d|      S )a  Display a horizontal rule.

        .. note::
            You can achieve the same effect with st.write("---") or
            even just "---" in your script (via magic).

        Example
        -------
        >>> import streamlit as st
        >>>
        >>> st.divider()

        r   )r   r   r   r   DIVIDERr   r   r   )r   divider_protos     r   r1   zMarkdownMixin.divider"  s>     &@%2%7%7%?%?"ww
M::r   c                    t        d|       S )zGet our DeltaGenerator.r   )r   )r   s    r   r   zMarkdownMixin.dg6  s     $d++r   )F)r   r
   r   boolr   
str | Nonereturnr   )python)r   r
   r%   r7   r8   r   )r   zSupportsStr | sympy.Exprr   r7   r8   r   )r8   r   )__name__
__module____qualname__r   r   r    r'   r,   r1   propertyr    r   r   r   r       sH   J #(e<
  e<e<  e<
 e< 
e<  e<N F  (#8#8 #8 
	#8 #8J I #(<;
  <;<;  <;
 <; 
<; <;| G
  	19&19 	19
 
19 19f I; ;& , ,r   r   )
__future__r   typingr   r   r   streamlit.proto.Markdown_pb2r   r   streamlit.runtime.metrics_utilr   streamlit.string_utilr	   streamlit.type_utilr
   r   r.   streamlit.delta_generatorr   r   __annotations__r   r>   r   r   <module>rG      s<    # - - B 9 , @8-2 #U 2Y, Y,r   