"""
This type stub file was generated by pyright.
"""
import html.entities
import html.parser
import re
import string
import urllib.parse as urlparse
from textwrap import wrap
from typing import Dict, List, Optional, Tuple, Union
from . import config
from ._typing import OutCallback
from .elements import AnchorElement, ListElement
from .utils import dumb_css_parser, element_style, escape_md, escape_md_section, google_fixed_width_font, google_has_height, google_list_style, google_text_emphasis, hn, list_numbering_start, pad_tables_in_text, skipwrap, unifiable_n
"""html2text: Turn HTML into equivalent Markdown-structured text."""
__version__ = ...
class HTML2Text(html.parser.HTMLParser):
def __init__(self, out: Optional[OutCallback] = ..., baseurl: str = ..., bodywidth: int = ...) -> None:
"""
Input parameters:
out: possible custom replacement for self.outtextf (which
appends lines of text).
baseurl: base URL of the document we process
"""
...
def update_params(self, **kwargs): # -> None:
...
def feed(self, data: str) -> None:
...
def handle(self, data: str) -> str:
...
def outtextf(self, s: str) -> None:
...
def finish(self) -> str:
...
def handle_charref(self, c: str) -> None:
...
def handle_entityref(self, c: str) -> None:
...
def handle_starttag(self, tag: str, attrs: List[Tuple[str, Optional[str]]]) -> None:
...
def handle_endtag(self, tag: str) -> None:
...
def previousIndex(self, attrs: Dict[str, Optional[str]]) -> Optional[int]:
"""
:type attrs: dict
:returns: The index of certain set of attributes (of a link) in the
self.a list. If the set of attributes is not found, returns None
:rtype: int
"""
...
def handle_emphasis(self, start: bool, tag_style: Dict[str, str], parent_style: Dict[str, str]) -> None:
"""
Handles various text emphases
"""
...
def handle_tag(self, tag: str, attrs: Dict[str, Optional[str]], start: bool) -> None:
...
def pbr(self) -> None:
"Pretty print has a line break"
...
def p(self) -> None:
"Set pretty print to 1 or 2 lines"
...
def soft_br(self) -> None:
"Soft breaks"
...
def o(self, data: str, puredata: bool = ..., force: Union[bool, str] = ...) -> None:
"""
Deal with indentation and whitespace
"""
...
def handle_data(self, data: str, entity_char: bool = ...) -> None:
...
def charref(self, name: str) -> str:
...
def entityref(self, c: str) -> str:
...
def google_nest_count(self, style: Dict[str, str]) -> int:
"""
Calculate the nesting count of google doc lists
:type style: dict
:rtype: int
"""
...
def optwrap(self, text: str) -> str:
"""
Wrap all paragraphs in the provided text.
:type text: str
:rtype: str
"""
...
def html2text(html: str, baseurl: str = ..., bodywidth: Optional[int] = ...) -> str:
...
class CustomHTML2Text(HTML2Text):
def __init__(self, *args, handle_code_in_pre=..., **kwargs) -> None:
...
def update_params(self, **kwargs): # -> None:
"""Update parameters and set preserved tags."""
...
def handle_tag(self, tag, attrs, start): # -> None:
...
def handle_data(self, data, entity_char=...): # -> None:
"""Override handle_data to capture content within preserved tags."""
...