Contributed stubs for markdown package (#4426)

Co-authored-by: Eric Traut <erictr@microsoft.com>
Co-authored-by: hauntsaninja <>
This commit is contained in:
Eric Traut
2020-08-10 13:33:31 -07:00
committed by GitHub
parent cac35d0631
commit 224da619f5
3 changed files with 63 additions and 0 deletions

View File

@@ -0,0 +1 @@
from .core import Markdown as Markdown, markdown as markdown, markdownFromFile as markdownFromFile

49
third_party/2and3/markdown/core.pyi vendored Normal file
View File

@@ -0,0 +1,49 @@
from typing import BinaryIO, Mapping, Optional, Sequence, Text, TextIO, Union
from typing_extensions import Literal
from .extensions import Extension
class Markdown:
def __init__(
self,
*,
extensions: Optional[Sequence[Union[str, Extension]]] = ...,
extension_configs: Optional[Mapping[str, Mapping[str, str]]] = ...,
output_format: Optional[Literal["xhtml", "html"]] = ...,
tab_length: Optional[int] = ...,
) -> None: ...
def build_parser(self) -> Markdown: ...
def registerExtensions(
self, extensions: Sequence[Union[Extension, str]], configs: Mapping[str, Mapping[str, str]]
) -> Markdown: ...
def build_extension(self, ext_name: Text, configs: Mapping[str, str]) -> Extension: ...
def registerExtension(self, extension: Extension) -> Markdown: ...
def reset(self: Markdown) -> Markdown: ...
def set_output_format(self, format: Literal["xhtml", "html"]) -> Markdown: ...
def is_block_level(self, tag: str) -> bool: ...
def convert(self, source: Text) -> Text: ...
def convertFile(
self,
input: Optional[Union[str, TextIO, BinaryIO]] = ...,
output: Optional[Union[str, TextIO, BinaryIO]] = ...,
encoding: Optional[str] = ...,
) -> Markdown: ...
def markdown(
text: Text,
*,
extensions: Optional[Sequence[Union[str, Extension]]] = ...,
extension_configs: Optional[Mapping[str, Mapping[str, str]]] = ...,
output_format: Optional[Literal["xhtml", "html"]] = ...,
tab_length: Optional[int] = ...,
) -> Text: ...
def markdownFromFile(
*,
input: Optional[Union[str, TextIO, BinaryIO]] = ...,
output: Optional[Union[str, TextIO, BinaryIO]] = ...,
encoding: Optional[str] = ...,
extensions: Optional[Sequence[Union[str, Extension]]] = ...,
extension_configs: Optional[Mapping[str, Mapping[str, str]]] = ...,
output_format: Optional[Literal["xhtml", "html"]] = ...,
tab_length: Optional[int] = ...,
) -> None: ...

View File

@@ -0,0 +1,13 @@
from typing import Mapping, Sequence
from ..core import Markdown
class Extension:
config: Mapping[str, str] = ...
def __init__(self, **kwargs: Mapping[str, str]) -> None: ...
def getConfig(self, key: str, default: str = ...) -> str: ...
def getConfigs(self) -> Mapping[str, str]: ...
def getConfigInfo(self) -> Sequence[Mapping[str, str]]: ...
def setConfig(self, key: str, value: str) -> None: ...
def setConfigs(self, items: Mapping[str, str]) -> None: ...
def extendMarkdown(self, md: Markdown) -> None: ...