Repository: streamlit/streamlit

Issue:
pytest raises error in doc-string
### Checklist

- [X] I have searched the [existing issues](https://github.com/streamlit/streamlit/issues) for similar issues.
- [X] I added a very descriptive title to this issue.
- [X] I have provided sufficient information below to help reproduce this issue.

### Summary

I tested the default example described in the [documentation](https://docs.streamlit.io/develop/concepts/app-testing/get-started) for testing an app.

Importing `from streamlit.testing.v1 import AppTest` at the beginning of the file resulted in two errors with the same error message `invalid escape sequence '\.'`. These errors occur in the doc-string of the file
- `elements/lib/column_types.py`
   -  line 535 `\.` occurs twice
   -  line 536 `\h` also raises an similar error `invalid escape sequence '\h'` 
- `elements/widgets/button.py` 
   - line 478 `\.` occurs there as well which raises the same error

### Reproducible Code Example

_No response_

### Steps To Reproduce

_No response_

### Expected Behavior

The example of the documentation should pass.

### Current Behavior

Error message:
```
(app-py3.10) user@user-15p:~/projects/app$ pytest -vv tests/test_streamlit.py 
====================================================================================================================================================================== test session starts =======================================================================================================================================================================
platform linux -- Python 3.10.11, pytest-7.4.4, pluggy-1.4.0 -- /home/user/.cache/pypoetry/virtualenvs/app-py3.10/bin/python
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase(PosixPath('/home/user/projects/app/.hypothesis/examples'))
rootdir: /home/user/projects/app
configfile: pyproject.toml
plugins: black-ng-0.4.1, xdist-3.5.0, cov-4.1.0, anyio-3.7.1, hydra-core-1.3.2, hypothesis-6.100.1, mypy-0.9.1, ruff-0.1.1, dotenv-0.5.2
collected 4 items / 1 error                                                                                                                                                                                                                                                                                                                                      

============================================================================================================================================================================= ERRORS =============================================================================================================================================================================
____________________________________________________________________________________________________________________________________________________________ ERROR collecting tests/test_streamlit.py ____________________________________________________________________________________________________________________________________________________________
../../.cache/pypoetry/virtualenvs/app-py3.10/lib/python3.10/site-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
../../.cache/pypoetry/virtualenvs/app-py3.10/lib/python3.10/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
../../.pyenv/versions/3.10.11/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
../../.cache/pypoetry/virtualenvs/app-py3.10/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
    exec(co, module.__dict__)
tests/test_streamlit.py:1: in <module>
    from streamlit.testing.v1 import AppTest
../../.cache/pypoetry/virtualenvs/app-py3.10/lib/python3.10/site-packages/streamlit/__init__.py:69: in <module>
    from streamlit.delta_generator import (
../../.cache/pypoetry/virtualenvs/app-py3.10/lib/python3.10/site-packages/streamlit/delta_generator.py:49: in <module>
    from streamlit.elements.arrow import ArrowMixin
../../.cache/pypoetry/virtualenvs/app-py3.10/lib/python3.10/site-packages/streamlit/elements/arrow.py:22: in <module>
    from streamlit.elements.lib.column_config_utils import (
../../.cache/pypoetry/virtualenvs/app-py3.10/lib/python3.10/site-packages/streamlit/elements/lib/column_config_utils.py:23: in <module>
    from streamlit.elements.lib.column_types import ColumnConfig, ColumnType
E     File "/home/user/.cache/pypoetry/virtualenvs/app-py3.10/lib/python3.10/site-packages/streamlit/elements/lib/column_types.py", line 488
E       """Configure a link column in ``st.dataframe`` or ``st.data_editor``.
E       ^^^
E   SyntaxError: invalid escape sequence '\.'
==================================================================================================================================================================== short test summary info =====================================================================================================================================================================
ERROR tests/test_streamlit.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================================================================================================================================== 1 error in 2.66s ========================================================================================================================================================================
```

### Is this a regression?

- [ ] Yes, this used to work in a previous version.

### Debug info

- Streamlit version: 1.33.0
- Python version: 3.10.11
- Operating System: Ubuntu 23.10
- Browser:


### Additional Information
As a minimal example
```python
def test_addition():
    """Additiond test `\.`."""
    assert 1 + 0 == 1
```
results in the  same error, so this error gets raised by the way the doc string is written in streamlit.


Discussion:
**If this issue affects you, please react with a 👍 (thumbs up emoji) to the initial post.**

Your feedback helps us prioritize which bugs to investigate and address first.

![Visits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fstreamlit%2Fstreamlit%2Fissues%2F8501&title=visits&edge_flat=false)


Resolving patch:
diff --git a/lib/streamlit/elements/lib/column_types.py b/lib/streamlit/elements/lib/column_types.py
--- a/lib/streamlit/elements/lib/column_types.py
+++ b/lib/streamlit/elements/lib/column_types.py
@@ -532,8 +532,8 @@ def LinkColumn(
         * A string that is displayed in every cell, e.g. ``"Open link"``.
 
         * A regular expression (JS flavor, detected by usage of parentheses)
-          to extract a part of the URL via a capture group, e.g. ``"https://(.*?)\.example\.com"``
-          to extract the display text "foo" from the URL "\https://foo.example.com".
+          to extract a part of the URL via a capture group, e.g. ``"https://(.*?)\\.example\\.com"``
+          to extract the display text "foo" from the URL "https://foo.example.com".
 
         For more complex cases, you may use `Pandas Styler's format \
         <https://pandas.pydata.org/docs/reference/api/pandas.io.formats.style.Styler.format.html>`_
diff --git a/lib/streamlit/elements/widgets/button.py b/lib/streamlit/elements/widgets/button.py
--- a/lib/streamlit/elements/widgets/button.py
+++ b/lib/streamlit/elements/widgets/button.py
@@ -438,7 +438,7 @@ def page_link(
         disabled: bool = False,
         use_container_width: bool | None = None,
     ) -> DeltaGenerator:
-        """Display a link to another page in a multipage app or to an external page.
+        r"""Display a link to another page in a multipage app or to an external page.
 
         If another page in a multipage app is specified, clicking ``st.page_link``
         stops the current page execution and runs the specified page as if the


Test patch: