* feat: add basic type stubs * feat: add types for constants * feat: add type for `MarkdownConverter` class * ci: add basic job for checking types * feat: add new constant * ci: install types as required * ci: install types package manually * test: add strict coverage for types * fix: allow `strip_document` to be `None` * feat: expand types for MarkdownConverter * fix: do not use `Unpack` as it requires Python 3.12 * feat: define `MarkdownConverter#convert_soup` * feat: improve type for `code_language_callback` * chore: add end-of-file newline * refactor: use `Union` for now
This commit is contained in:
77
markdownify/__init__.pyi
Normal file
77
markdownify/__init__.pyi
Normal file
@@ -0,0 +1,77 @@
|
||||
from _typeshed import Incomplete
|
||||
from typing import Callable, Union
|
||||
|
||||
ATX: str
|
||||
ATX_CLOSED: str
|
||||
UNDERLINED: str
|
||||
SETEXT = UNDERLINED
|
||||
SPACES: str
|
||||
BACKSLASH: str
|
||||
ASTERISK: str
|
||||
UNDERSCORE: str
|
||||
LSTRIP: str
|
||||
RSTRIP: str
|
||||
STRIP: str
|
||||
STRIP_ONE: str
|
||||
|
||||
|
||||
def markdownify(
|
||||
html: str,
|
||||
autolinks: bool = ...,
|
||||
bs4_options: str = ...,
|
||||
bullets: str = ...,
|
||||
code_language: str = ...,
|
||||
code_language_callback: Union[Callable[[Incomplete], Union[str, None]], None] = ...,
|
||||
convert: Union[list[str], None] = ...,
|
||||
default_title: bool = ...,
|
||||
escape_asterisks: bool = ...,
|
||||
escape_underscores: bool = ...,
|
||||
escape_misc: bool = ...,
|
||||
heading_style: str = ...,
|
||||
keep_inline_images_in: list[str] = ...,
|
||||
newline_style: str = ...,
|
||||
strip: Union[list[str], None] = ...,
|
||||
strip_document: Union[str, None] = ...,
|
||||
strip_pre: str = ...,
|
||||
strong_em_symbol: str = ...,
|
||||
sub_symbol: str = ...,
|
||||
sup_symbol: str = ...,
|
||||
table_infer_header: bool = ...,
|
||||
wrap: bool = ...,
|
||||
wrap_width: int = ...,
|
||||
) -> str: ...
|
||||
|
||||
|
||||
class MarkdownConverter:
|
||||
def __init__(
|
||||
self,
|
||||
autolinks: bool = ...,
|
||||
bs4_options: str = ...,
|
||||
bullets: str = ...,
|
||||
code_language: str = ...,
|
||||
code_language_callback: Union[Callable[[Incomplete], Union[str, None]], None] = ...,
|
||||
convert: Union[list[str], None] = ...,
|
||||
default_title: bool = ...,
|
||||
escape_asterisks: bool = ...,
|
||||
escape_underscores: bool = ...,
|
||||
escape_misc: bool = ...,
|
||||
heading_style: str = ...,
|
||||
keep_inline_images_in: list[str] = ...,
|
||||
newline_style: str = ...,
|
||||
strip: Union[list[str], None] = ...,
|
||||
strip_document: Union[str, None] = ...,
|
||||
strip_pre: str = ...,
|
||||
strong_em_symbol: str = ...,
|
||||
sub_symbol: str = ...,
|
||||
sup_symbol: str = ...,
|
||||
table_infer_header: bool = ...,
|
||||
wrap: bool = ...,
|
||||
wrap_width: int = ...,
|
||||
) -> None:
|
||||
...
|
||||
|
||||
def convert(self, html: str) -> str:
|
||||
...
|
||||
|
||||
def convert_soup(self, soup: Incomplete) -> str:
|
||||
...
|
||||
Reference in New Issue
Block a user