mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-27 18:45:05 +08:00
💡 add escape_tag docstring
This commit is contained in:
parent
5b0083c0a8
commit
ef29280585
@ -11,6 +11,14 @@ from nonebot.typing import Any, Callable, Awaitable, overrides
|
||||
|
||||
|
||||
def escape_tag(s: str) -> str:
|
||||
"""
|
||||
:说明:
|
||||
用于记录带颜色日志时转义 `<tag>` 类型特殊标签
|
||||
:参数:
|
||||
* ``s: str``: 需要转义的字符串
|
||||
:返回:
|
||||
- ``str``
|
||||
"""
|
||||
return re.sub(r"</?((?:[fb]g\s)?[^<>\s]*)>", r"\\\g<0>", s)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user