mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 08:47:39 +08:00
Various improvements to Markdown stubs (#10963)
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
markdown.extensions.abbr.ABBR_REF_RE
|
||||
markdown.extensions.attr_list.AttrListTreeprocessor.run
|
||||
markdown.extensions.codehilite.CodeHilite.__init__
|
||||
markdown.extensions.fenced_code.FencedBlockPreprocessor.__init__
|
||||
markdown.extensions.footnotes.DEF_RE
|
||||
markdown.extensions.footnotes.FootnotePreprocessor
|
||||
markdown.extensions.footnotes.TABBED_RE
|
||||
markdown.extensions.legacy_attrs.LegacyAttrs.run
|
||||
markdown.extensions.toc.TocTreeprocessor.run
|
||||
markdown.extensions.toc.slugify
|
||||
markdown.postprocessors.UnescapePostprocessor # deprecated
|
||||
|
||||
@@ -2,8 +2,8 @@ from collections.abc import Iterable
|
||||
from typing import Any, TypeVar
|
||||
from xml.etree.ElementTree import Element, ElementTree
|
||||
|
||||
from . import Markdown
|
||||
from .util import Registry
|
||||
from markdown import blockprocessors, util
|
||||
from markdown.core import Markdown
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@@ -13,7 +13,7 @@ class State(list[_T]):
|
||||
def isstate(self, state: _T) -> bool: ...
|
||||
|
||||
class BlockParser:
|
||||
blockprocessors: Registry
|
||||
blockprocessors: util.Registry[blockprocessors.BlockProcessor]
|
||||
state: State[Any] # TODO: possible to get rid of Any?
|
||||
md: Markdown
|
||||
def __init__(self, md: Markdown) -> None: ...
|
||||
|
||||
@@ -3,13 +3,12 @@ from re import Match, Pattern
|
||||
from typing import Any, ClassVar
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
from markdown import Markdown
|
||||
|
||||
from .blockparser import BlockParser
|
||||
from markdown.blockparser import BlockParser
|
||||
from markdown.core import Markdown
|
||||
|
||||
logger: Logger
|
||||
|
||||
def build_block_parser(md: Markdown, **kwargs: Any): ...
|
||||
def build_block_parser(md: Markdown, **kwargs: Any) -> BlockParser: ...
|
||||
|
||||
class BlockProcessor:
|
||||
parser: BlockParser
|
||||
|
||||
@@ -3,7 +3,7 @@ from typing import Any, ClassVar, Protocol
|
||||
from typing_extensions import Literal, Self
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
from .blockparser import BlockParser
|
||||
from . import blockparser, inlinepatterns, postprocessors, preprocessors, treeprocessors
|
||||
from .extensions import Extension
|
||||
from .util import HtmlStash, Registry
|
||||
|
||||
@@ -20,11 +20,11 @@ class _ReadableStream(Protocol):
|
||||
def close(self) -> object: ...
|
||||
|
||||
class Markdown:
|
||||
preprocessors: Registry
|
||||
inlinePatterns: Registry
|
||||
treeprocessors: Registry
|
||||
postprocessors: Registry
|
||||
parser: BlockParser
|
||||
preprocessors: Registry[preprocessors.Preprocessor]
|
||||
inlinePatterns: Registry[inlinepatterns.InlineProcessor]
|
||||
treeprocessors: Registry[treeprocessors.Treeprocessor]
|
||||
postprocessors: Registry[postprocessors.Postprocessor]
|
||||
parser: blockparser.BlockParser
|
||||
htmlStash: HtmlStash
|
||||
output_formats: ClassVar[dict[Literal["xhtml", "html"], Callable[[Element], str]]]
|
||||
output_format: Literal["xhtml", "html"]
|
||||
@@ -41,17 +41,17 @@ class Markdown:
|
||||
output_format: Literal["xhtml", "html"] | None = ...,
|
||||
tab_length: int | None = ...,
|
||||
) -> None: ...
|
||||
def build_parser(self) -> Markdown: ...
|
||||
def registerExtensions(self, extensions: Sequence[Extension | str], configs: Mapping[str, Mapping[str, Any]]) -> Markdown: ...
|
||||
def build_extension(self, ext_name: str, configs: Mapping[str, str]) -> Extension: ...
|
||||
def registerExtension(self, extension: Extension) -> Markdown: ...
|
||||
def build_parser(self) -> Self: ...
|
||||
def registerExtensions(self, extensions: Sequence[Extension | str], configs: Mapping[str, dict[str, Any]]) -> Self: ...
|
||||
def build_extension(self, ext_name: str, configs: Mapping[str, Any]) -> Extension: ...
|
||||
def registerExtension(self, extension: Extension) -> Self: ...
|
||||
def reset(self) -> Self: ...
|
||||
def set_output_format(self, format: Literal["xhtml", "html"]) -> Markdown: ...
|
||||
def is_block_level(self, tag: str) -> bool: ...
|
||||
def set_output_format(self, format: Literal["xhtml", "html"]) -> Self: ...
|
||||
def is_block_level(self, tag: object) -> bool: ...
|
||||
def convert(self, source: str) -> str: ...
|
||||
def convertFile(
|
||||
self, input: str | _ReadableStream | None = None, output: str | _WritableStream | None = None, encoding: str | None = None
|
||||
) -> Markdown: ...
|
||||
) -> Self: ...
|
||||
|
||||
def markdown(
|
||||
text: str,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from collections.abc import Mapping
|
||||
from collections.abc import Iterable, Mapping
|
||||
from typing import Any
|
||||
|
||||
from markdown.core import Markdown
|
||||
@@ -10,5 +10,5 @@ class Extension:
|
||||
def getConfigs(self) -> dict[str, Any]: ...
|
||||
def getConfigInfo(self) -> list[tuple[str, str]]: ...
|
||||
def setConfig(self, key: str, value: Any) -> None: ...
|
||||
def setConfigs(self, items: Mapping[str, Any]) -> None: ...
|
||||
def setConfigs(self, items: Mapping[str, Any] | Iterable[tuple[str, Any]]) -> None: ...
|
||||
def extendMarkdown(self, md: Markdown) -> None: ...
|
||||
|
||||
@@ -12,6 +12,6 @@ class AbbrPreprocessor(BlockProcessor): ...
|
||||
|
||||
class AbbrInlineProcessor(InlineProcessor):
|
||||
title: Any
|
||||
def __init__(self, pattern, title) -> None: ...
|
||||
def __init__(self, pattern: str, title: str) -> None: ...
|
||||
|
||||
def makeExtension(**kwargs): ...
|
||||
def makeExtension(**kwargs) -> AbbrExtension: ...
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
from re import Pattern
|
||||
from re import Match, Pattern
|
||||
from typing import Any
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
from markdown import blockparser
|
||||
from markdown.blockprocessors import BlockProcessor
|
||||
from markdown.extensions import Extension
|
||||
|
||||
@@ -11,6 +13,8 @@ class AdmonitionProcessor(BlockProcessor):
|
||||
CLASSNAME_TITLE: str
|
||||
RE: Pattern[str]
|
||||
RE_SPACES: Any
|
||||
def get_class_and_title(self, match): ...
|
||||
def __init__(self, parser: blockparser.BlockParser): ...
|
||||
def parse_content(self, parent: Element, block: str) -> tuple[Element | None, str, str]: ...
|
||||
def get_class_and_title(self, match: Match[str]) -> tuple[str, str | None]: ...
|
||||
|
||||
def makeExtension(**kwargs): ...
|
||||
def makeExtension(**kwargs) -> AdmonitionExtension: ...
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from re import Pattern
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
from markdown.extensions import Extension
|
||||
from markdown.treeprocessors import Treeprocessor
|
||||
|
||||
def get_attrs(str): ...
|
||||
def isheader(elem): ...
|
||||
def get_attrs(str: str) -> list[tuple[str, str]]: ...
|
||||
def isheader(elem: Element) -> bool: ...
|
||||
|
||||
class AttrListTreeprocessor(Treeprocessor):
|
||||
BASE_RE: str
|
||||
@@ -12,9 +13,9 @@ class AttrListTreeprocessor(Treeprocessor):
|
||||
BLOCK_RE: Pattern[str]
|
||||
INLINE_RE: Pattern[str]
|
||||
NAME_RE: Pattern[str]
|
||||
def assign_attrs(self, elem, attrs) -> None: ...
|
||||
def sanitize_name(self, name): ...
|
||||
def assign_attrs(self, elem: Element, attrs: str) -> None: ...
|
||||
def sanitize_name(self, name: str) -> str: ...
|
||||
|
||||
class AttrListExtension(Extension): ...
|
||||
|
||||
def makeExtension(**kwargs): ...
|
||||
def makeExtension(**kwargs) -> AttrListExtension: ...
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from _typeshed import Incomplete
|
||||
from typing import Any
|
||||
|
||||
from markdown.extensions import Extension
|
||||
@@ -22,25 +21,25 @@ class CodeHilite:
|
||||
options: dict[str, Any]
|
||||
def __init__(
|
||||
self,
|
||||
src: Incomplete | None = ...,
|
||||
src: str,
|
||||
*,
|
||||
linenums: Incomplete | None = ...,
|
||||
linenums: bool | None = None,
|
||||
guess_lang: bool = ...,
|
||||
css_class: str = ...,
|
||||
lang: Incomplete | None = ...,
|
||||
lang: str | None = ...,
|
||||
style: str = ...,
|
||||
noclasses: bool = ...,
|
||||
tab_length: int = ...,
|
||||
hl_lines: Incomplete | None = ...,
|
||||
hl_lines: list[int] = ...,
|
||||
use_pygments: bool = ...,
|
||||
**options: Any,
|
||||
) -> None: ...
|
||||
def hilite(self, shebang: bool = True) -> str: ...
|
||||
|
||||
class HiliteTreeprocessor(Treeprocessor):
|
||||
def code_unescape(self, text): ...
|
||||
def code_unescape(self, text: str) -> str: ...
|
||||
|
||||
class CodeHiliteExtension(Extension):
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
|
||||
def makeExtension(**kwargs): ...
|
||||
def makeExtension(**kwargs) -> CodeHiliteExtension: ...
|
||||
|
||||
@@ -10,4 +10,4 @@ class DefListProcessor(BlockProcessor):
|
||||
class DefListIndentProcessor(ListIndentProcessor): ...
|
||||
class DefListExtension(Extension): ...
|
||||
|
||||
def makeExtension(**kwargs): ...
|
||||
def makeExtension(**kwargs) -> DefListExtension: ...
|
||||
|
||||
@@ -7,4 +7,4 @@ extensions: Any
|
||||
class ExtraExtension(Extension):
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
|
||||
def makeExtension(**kwargs): ...
|
||||
def makeExtension(**kwargs) -> ExtraExtension: ...
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from _typeshed import Incomplete
|
||||
from re import Pattern
|
||||
from typing import ClassVar
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from markdown.core import Markdown
|
||||
from markdown.extensions import Extension
|
||||
from markdown.preprocessors import Preprocessor
|
||||
|
||||
@@ -9,7 +9,7 @@ class FencedCodeExtension(Extension): ...
|
||||
|
||||
class FencedBlockPreprocessor(Preprocessor):
|
||||
FENCED_BLOCK_RE: ClassVar[Pattern[str]]
|
||||
codehilite_conf: dict[Incomplete, Incomplete]
|
||||
def __init__(self, md) -> None: ...
|
||||
codehilite_conf: dict[str, Any]
|
||||
def __init__(self, md: Markdown, config: dict[str, Any]) -> None: ...
|
||||
|
||||
def makeExtension(**kwargs): ...
|
||||
def makeExtension(**kwargs) -> FencedCodeExtension: ...
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
from collections import OrderedDict
|
||||
from re import Pattern
|
||||
from typing import Any
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
from markdown.core import Markdown
|
||||
from markdown.extensions import Extension
|
||||
from markdown.inlinepatterns import InlineProcessor
|
||||
from markdown.postprocessors import Postprocessor
|
||||
from markdown.preprocessors import Preprocessor
|
||||
from markdown.treeprocessors import Treeprocessor
|
||||
|
||||
FN_BACKLINK_TEXT: Any
|
||||
@@ -21,39 +22,34 @@ class FootnoteExtension(Extension):
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
parser: Any
|
||||
md: Markdown
|
||||
footnotes: Any
|
||||
footnotes: OrderedDict[str, str]
|
||||
def reset(self) -> None: ...
|
||||
def unique_ref(self, reference, found: bool = False): ...
|
||||
def findFootnotesPlaceholder(self, root): ...
|
||||
def setFootnote(self, id, text) -> None: ...
|
||||
def get_separator(self): ...
|
||||
def makeFootnoteId(self, id): ...
|
||||
def makeFootnoteRefId(self, id, found: bool = False): ...
|
||||
def makeFootnotesDiv(self, root): ...
|
||||
|
||||
class FootnotePreprocessor(Preprocessor):
|
||||
footnotes: Any
|
||||
def __init__(self, footnotes) -> None: ...
|
||||
def detectTabbed(self, lines): ...
|
||||
def unique_ref(self, reference: str, found: bool = False) -> str: ...
|
||||
def findFootnotesPlaceholder(self, root: Element): ...
|
||||
def setFootnote(self, id: str, text: str) -> None: ...
|
||||
def get_separator(self) -> str: ...
|
||||
def makeFootnoteId(self, id: str) -> str: ...
|
||||
def makeFootnoteRefId(self, id: str, found: bool = False) -> str: ...
|
||||
def makeFootnotesDiv(self, root: Element) -> Element | None: ...
|
||||
|
||||
class FootnoteInlineProcessor(InlineProcessor):
|
||||
footnotes: Any
|
||||
def __init__(self, pattern, footnotes) -> None: ...
|
||||
footnotes: FootnoteExtension
|
||||
def __init__(self, pattern: str, footnotes: FootnoteExtension) -> None: ...
|
||||
|
||||
class FootnotePostTreeprocessor(Treeprocessor):
|
||||
footnotes: Any
|
||||
def __init__(self, footnotes) -> None: ...
|
||||
footnotes: FootnoteExtension
|
||||
def __init__(self, footnotes: FootnoteExtension) -> None: ...
|
||||
def add_duplicates(self, li, duplicates) -> None: ...
|
||||
def get_num_duplicates(self, li): ...
|
||||
def handle_duplicates(self, parent) -> None: ...
|
||||
offset: int
|
||||
|
||||
class FootnoteTreeprocessor(Treeprocessor):
|
||||
footnotes: Any
|
||||
def __init__(self, footnotes) -> None: ...
|
||||
footnotes: FootnoteExtension
|
||||
def __init__(self, footnotes: FootnoteExtension) -> None: ...
|
||||
|
||||
class FootnotePostprocessor(Postprocessor):
|
||||
footnotes: Any
|
||||
def __init__(self, footnotes) -> None: ...
|
||||
footnotes: FootnoteExtension
|
||||
def __init__(self, footnotes: FootnoteExtension) -> None: ...
|
||||
|
||||
def makeExtension(**kwargs): ...
|
||||
def makeExtension(**kwargs) -> FootnoteExtension: ...
|
||||
|
||||
@@ -10,4 +10,4 @@ class LegacyAttrs(Treeprocessor):
|
||||
|
||||
class LegacyAttrExtension(Extension): ...
|
||||
|
||||
def makeExtension(**kwargs): ...
|
||||
def makeExtension(**kwargs) -> LegacyAttrExtension: ...
|
||||
|
||||
@@ -8,4 +8,4 @@ STRONG_EM_RE: str
|
||||
class LegacyUnderscoreProcessor(UnderscoreProcessor): ...
|
||||
class LegacyEmExtension(Extension): ...
|
||||
|
||||
def makeExtension(**kwargs): ...
|
||||
def makeExtension(**kwargs) -> LegacyEmExtension: ...
|
||||
|
||||
@@ -4,4 +4,4 @@ from markdown.extensions import Extension
|
||||
class MarkdownInHtmlProcessor(BlockProcessor): ...
|
||||
class MarkdownInHtmlExtension(Extension): ...
|
||||
|
||||
def makeExtension(**kwargs): ...
|
||||
def makeExtension(**kwargs) -> MarkdownInHtmlExtension: ...
|
||||
|
||||
@@ -17,4 +17,4 @@ class MetaExtension(Extension):
|
||||
|
||||
class MetaPreprocessor(Preprocessor): ...
|
||||
|
||||
def makeExtension(**kwargs): ...
|
||||
def makeExtension(**kwargs) -> MetaExtension: ...
|
||||
|
||||
@@ -4,4 +4,4 @@ BR_RE: str
|
||||
|
||||
class Nl2BrExtension(Extension): ...
|
||||
|
||||
def makeExtension(**kwargs): ...
|
||||
def makeExtension(**kwargs) -> Nl2BrExtension: ...
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
from markdown import blockparser
|
||||
from markdown.blockprocessors import OListProcessor, UListProcessor
|
||||
from markdown.extensions import Extension
|
||||
|
||||
class SaneOListProcessor(OListProcessor):
|
||||
def __init__(self, parser) -> None: ...
|
||||
def __init__(self, parser: blockparser.BlockParser) -> None: ...
|
||||
|
||||
class SaneUListProcessor(UListProcessor):
|
||||
def __init__(self, parser) -> None: ...
|
||||
def __init__(self, parser: blockparser.BlockParser) -> None: ...
|
||||
|
||||
class SaneListExtension(Extension): ...
|
||||
|
||||
def makeExtension(**kwargs): ...
|
||||
def makeExtension(**kwargs) -> SaneListExtension: ...
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
from collections.abc import Sequence
|
||||
from typing import Any
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
from markdown import inlinepatterns, util
|
||||
from markdown.core import Markdown
|
||||
from markdown.extensions import Extension
|
||||
from markdown.inlinepatterns import HtmlInlineProcessor
|
||||
|
||||
@@ -24,16 +28,16 @@ remainingDoubleQuotesRegex: str
|
||||
HTML_STRICT_RE: str
|
||||
|
||||
class SubstituteTextPattern(HtmlInlineProcessor):
|
||||
replace: Any
|
||||
def __init__(self, pattern, replace, md) -> None: ...
|
||||
replace: Sequence[int | str | Element]
|
||||
def __init__(self, pattern: str, replace: Sequence[int | str | Element], md: Markdown) -> None: ...
|
||||
|
||||
class SmartyExtension(Extension):
|
||||
substitutions: Any
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
def educateDashes(self, md) -> None: ...
|
||||
def educateEllipses(self, md) -> None: ...
|
||||
def educateAngledQuotes(self, md) -> None: ...
|
||||
def educateQuotes(self, md) -> None: ...
|
||||
inlinePatterns: Any
|
||||
def educateDashes(self, md: Markdown) -> None: ...
|
||||
def educateEllipses(self, md: Markdown) -> None: ...
|
||||
def educateAngledQuotes(self, md: Markdown) -> None: ...
|
||||
def educateQuotes(self, md: Markdown) -> None: ...
|
||||
inlinePatterns: util.Registry[inlinepatterns.InlineProcessor]
|
||||
|
||||
def makeExtension(**kwargs): ...
|
||||
def makeExtension(**kwargs) -> SmartyExtension: ...
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from re import Pattern
|
||||
from typing import ClassVar
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from markdown import blockparser
|
||||
from markdown.blockprocessors import BlockProcessor
|
||||
from markdown.extensions import Extension
|
||||
|
||||
@@ -13,8 +14,8 @@ class TableProcessor(BlockProcessor):
|
||||
RE_END_BORDER: ClassVar[Pattern[str]]
|
||||
border: bool
|
||||
separator: str
|
||||
def __init__(self, parser, config) -> None: ...
|
||||
def __init__(self, parser: blockparser.BlockParser, config: dict[str, Any]) -> None: ...
|
||||
|
||||
class TableExtension(Extension): ...
|
||||
|
||||
def makeExtension(**kwargs): ...
|
||||
def makeExtension(**kwargs) -> TableExtension: ...
|
||||
|
||||
@@ -1,19 +1,30 @@
|
||||
from collections.abc import Iterator, MutableSet
|
||||
from re import Pattern
|
||||
from typing import Any
|
||||
from typing_extensions import TypedDict
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
from markdown.core import Markdown
|
||||
from markdown.extensions import Extension
|
||||
from markdown.treeprocessors import Treeprocessor
|
||||
|
||||
def slugify(value, separator): ...
|
||||
|
||||
IDCOUNT_RE: Pattern[str]
|
||||
|
||||
def unique(id, ids): ...
|
||||
def get_name(el): ...
|
||||
def stashedHTML2text(text, md, strip_entities: bool = True): ...
|
||||
def unescape(text): ...
|
||||
def nest_toc_tokens(toc_list): ...
|
||||
class _FlatTocToken(TypedDict):
|
||||
level: int
|
||||
id: str
|
||||
name: str
|
||||
|
||||
class _TocToken(_FlatTocToken):
|
||||
children: list[_TocToken]
|
||||
|
||||
def slugify(value: str, separator: str, unicode: bool = False) -> str: ...
|
||||
def slugify_unicode(value: str, separator: str) -> str: ...
|
||||
def unique(id: str, ids: MutableSet[str]) -> str: ...
|
||||
def get_name(el: Element) -> str: ...
|
||||
def stashedHTML2text(text: str, md: Markdown, strip_entities: bool = True) -> str: ...
|
||||
def unescape(text: str) -> str: ...
|
||||
def nest_toc_tokens(toc_list: list[_FlatTocToken]) -> list[_TocToken]: ...
|
||||
|
||||
class TocTreeprocessor(Treeprocessor):
|
||||
marker: Any
|
||||
@@ -29,18 +40,18 @@ class TocTreeprocessor(Treeprocessor):
|
||||
header_rgx: Any
|
||||
toc_top: int
|
||||
toc_bottom: Any
|
||||
def __init__(self, md, config) -> None: ...
|
||||
def iterparent(self, node) -> None: ...
|
||||
def replace_marker(self, root, elem) -> None: ...
|
||||
def set_level(self, elem) -> None: ...
|
||||
def add_anchor(self, c, elem_id) -> None: ...
|
||||
def add_permalink(self, c, elem_id) -> None: ...
|
||||
def build_toc_div(self, toc_list): ...
|
||||
def __init__(self, md: Markdown, config: dict[str, Any]) -> None: ...
|
||||
def iterparent(self, node: Element) -> Iterator[tuple[Element, Element]]: ...
|
||||
def replace_marker(self, root: Element, elem: Element) -> None: ...
|
||||
def set_level(self, elem: Element) -> None: ...
|
||||
def add_anchor(self, c: Element, elem_id: str) -> None: ...
|
||||
def add_permalink(self, c: Element, elem_id: str) -> None: ...
|
||||
def build_toc_div(self, toc_list: list[_TocToken]) -> Element: ...
|
||||
|
||||
class TocExtension(Extension):
|
||||
TreeProcessorClass: Any
|
||||
TreeProcessorClass: type[TocTreeprocessor]
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
md: Markdown
|
||||
def reset(self) -> None: ...
|
||||
|
||||
def makeExtension(**kwargs): ...
|
||||
def makeExtension(**kwargs) -> TocExtension: ...
|
||||
|
||||
@@ -4,14 +4,14 @@ from markdown.core import Markdown
|
||||
from markdown.extensions import Extension
|
||||
from markdown.inlinepatterns import InlineProcessor
|
||||
|
||||
def build_url(label, base, end): ...
|
||||
def build_url(label: str, base: str, end: str) -> str: ...
|
||||
|
||||
class WikiLinkExtension(Extension):
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
md: Markdown
|
||||
|
||||
class WikiLinksInlineProcessor(InlineProcessor):
|
||||
config: Any
|
||||
def __init__(self, pattern, config) -> None: ...
|
||||
config: dict[str, Any]
|
||||
def __init__(self, pattern: str, config: dict[str, Any]) -> None: ...
|
||||
|
||||
def makeExtension(**kwargs): ...
|
||||
def makeExtension(**kwargs) -> WikiLinkExtension: ...
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import re
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Collection
|
||||
from typing import Any, ClassVar, NamedTuple
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
from markdown import util
|
||||
from markdown.core import Markdown
|
||||
|
||||
def build_inlinepatterns(md, **kwargs): ...
|
||||
def build_inlinepatterns(md: Markdown, **kwargs) -> util.Registry[InlineProcessor]: ...
|
||||
|
||||
NOIMG: str
|
||||
BACKTICK_RE: str
|
||||
@@ -31,29 +32,27 @@ HTML_RE: str
|
||||
ENTITY_RE: str
|
||||
LINE_BREAK_RE: str
|
||||
|
||||
def dequote(string): ...
|
||||
def dequote(string: str) -> str: ...
|
||||
|
||||
class _EmStrongItemBase(NamedTuple):
|
||||
class EmStrongItem(NamedTuple):
|
||||
pattern: re.Pattern[str]
|
||||
builder: str
|
||||
tags: str
|
||||
|
||||
class EmStrongItem(_EmStrongItemBase): ...
|
||||
|
||||
class Pattern:
|
||||
ANCESTOR_EXCLUDES: ClassVar[tuple[Incomplete, ...]]
|
||||
pattern: Any
|
||||
ANCESTOR_EXCLUDES: ClassVar[Collection[str]]
|
||||
pattern: str
|
||||
compiled_re: re.Pattern[str]
|
||||
md: Markdown
|
||||
def __init__(self, pattern, md: Markdown | None = None) -> None: ...
|
||||
def getCompiledRegExp(self): ...
|
||||
def __init__(self, pattern: str, md: Markdown | None = None) -> None: ...
|
||||
def getCompiledRegExp(self) -> re.Pattern[str]: ...
|
||||
def handleMatch(self, m: re.Match[str]) -> str | Element | None: ...
|
||||
def type(self): ...
|
||||
def unescape(self, text): ...
|
||||
def type(self) -> str: ...
|
||||
def unescape(self, text: str) -> str: ...
|
||||
|
||||
class InlineProcessor(Pattern):
|
||||
safe_mode: bool
|
||||
def __init__(self, pattern, md: Markdown | None = None) -> None: ...
|
||||
def __init__(self, pattern: str, md: Markdown | None = None) -> None: ...
|
||||
def handleMatch(self, m: re.Match[str], data) -> tuple[Element, int, int] | tuple[None, None, None]: ... # type: ignore[override]
|
||||
|
||||
class SimpleTextPattern(Pattern): ...
|
||||
@@ -62,11 +61,11 @@ class EscapeInlineProcessor(InlineProcessor): ...
|
||||
|
||||
class SimpleTagPattern(Pattern):
|
||||
tag: Any
|
||||
def __init__(self, pattern, tag) -> None: ...
|
||||
def __init__(self, pattern: str, tag: str) -> None: ...
|
||||
|
||||
class SimpleTagInlineProcessor(InlineProcessor):
|
||||
tag: Any
|
||||
def __init__(self, pattern, tag) -> None: ...
|
||||
def __init__(self, pattern: str, tag: str) -> None: ...
|
||||
|
||||
class SubstituteTagPattern(SimpleTagPattern): ...
|
||||
class SubstituteTagInlineProcessor(SimpleTagInlineProcessor): ...
|
||||
@@ -74,7 +73,7 @@ class SubstituteTagInlineProcessor(SimpleTagInlineProcessor): ...
|
||||
class BacktickInlineProcessor(InlineProcessor):
|
||||
ESCAPED_BSLASH: Any
|
||||
tag: str
|
||||
def __init__(self, pattern) -> None: ...
|
||||
def __init__(self, pattern: str) -> None: ...
|
||||
|
||||
class DoubleTagPattern(SimpleTagPattern): ...
|
||||
class DoubleTagInlineProcessor(SimpleTagInlineProcessor): ...
|
||||
@@ -82,26 +81,26 @@ class HtmlInlineProcessor(InlineProcessor): ...
|
||||
|
||||
class AsteriskProcessor(InlineProcessor):
|
||||
PATTERNS: ClassVar[list[EmStrongItem]]
|
||||
def build_single(self, m, tag, idx): ...
|
||||
def build_double(self, m, tags, idx): ...
|
||||
def build_double2(self, m, tags, idx): ...
|
||||
def parse_sub_patterns(self, data, parent, last, idx) -> None: ...
|
||||
def build_element(self, m, builder, tags, index): ...
|
||||
def build_single(self, m: re.Match[str], tag: str, idx: int) -> Element: ...
|
||||
def build_double(self, m: re.Match[str], tags: str, idx: int) -> Element: ...
|
||||
def build_double2(self, m: re.Match[str], tags: str, idx: int) -> Element: ...
|
||||
def parse_sub_patterns(self, data: str, parent: Element, last: Element | None, idx: int) -> None: ...
|
||||
def build_element(self, m: re.Match[str], builder: str, tags: str, index: int) -> Element: ...
|
||||
|
||||
class UnderscoreProcessor(AsteriskProcessor): ...
|
||||
|
||||
class LinkInlineProcessor(InlineProcessor):
|
||||
RE_LINK: ClassVar[re.Pattern[str]]
|
||||
RE_TITLE_CLEAN: ClassVar[re.Pattern[str]]
|
||||
def getLink(self, data, index): ...
|
||||
def getText(self, data, index): ...
|
||||
def getLink(self, data: str, index: int): ...
|
||||
def getText(self, data: str, index: int): ...
|
||||
|
||||
class ImageInlineProcessor(LinkInlineProcessor): ...
|
||||
|
||||
class ReferenceInlineProcessor(LinkInlineProcessor):
|
||||
NEWLINE_CLEANUP_RE: ClassVar[re.Pattern[str]]
|
||||
def evalId(self, data, index, text): ...
|
||||
def makeTag(self, href, title, text): ...
|
||||
def evalId(self, data: str, index: int, text: str): ...
|
||||
def makeTag(self, href: str, title: str, text: str) -> Element: ...
|
||||
|
||||
class ShortReferenceInlineProcessor(ReferenceInlineProcessor): ...
|
||||
class ImageReferenceInlineProcessor(ReferenceInlineProcessor): ...
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
from re import Pattern
|
||||
from typing import Any
|
||||
from markdown.core import Markdown
|
||||
|
||||
from . import util
|
||||
|
||||
def build_postprocessors(md, **kwargs): ...
|
||||
def build_postprocessors(md: Markdown, **kwargs) -> util.Registry[Postprocessor]: ...
|
||||
|
||||
class Postprocessor(util.Processor):
|
||||
def run(self, text) -> Any: ...
|
||||
def run(self, text: str) -> str: ...
|
||||
|
||||
class RawHtmlPostprocessor(Postprocessor):
|
||||
def isblocklevel(self, html): ...
|
||||
def isblocklevel(self, html: str) -> bool: ...
|
||||
def stash_to_string(self, text: str) -> str: ...
|
||||
|
||||
class AndSubstitutePostprocessor(Postprocessor): ...
|
||||
|
||||
class UnescapePostprocessor(Postprocessor): # deprecated
|
||||
RE: Pattern[str]
|
||||
def unescape(self, m): ...
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
from typing import Any
|
||||
|
||||
from markdown.core import Markdown
|
||||
|
||||
from . import util
|
||||
|
||||
def build_preprocessors(md, **kwargs): ...
|
||||
def build_preprocessors(md: Markdown, **kwargs) -> util.Registry[Preprocessor]: ...
|
||||
|
||||
class Preprocessor(util.Processor):
|
||||
def run(self, lines: list[str]) -> list[str]: ...
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
def to_html_string(element): ...
|
||||
def to_xhtml_string(element): ...
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
def to_html_string(element: Element) -> str: ...
|
||||
def to_xhtml_string(element: Element) -> str: ...
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
from _typeshed import Incomplete
|
||||
from re import Pattern
|
||||
from typing import Any, ClassVar
|
||||
from typing_extensions import TypeGuard
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
from . import util
|
||||
from markdown import util
|
||||
from markdown.core import Markdown
|
||||
|
||||
def build_treeprocessors(md, **kwargs): ...
|
||||
def isString(s): ...
|
||||
def build_treeprocessors(md: Markdown, **kwargs) -> util.Registry[Treeprocessor]: ...
|
||||
def isString(s: object) -> TypeGuard[str]: ...
|
||||
|
||||
class Treeprocessor(util.Processor):
|
||||
def run(self, root: Element) -> Element | None: ...
|
||||
@@ -17,7 +18,7 @@ class InlineProcessor(Treeprocessor):
|
||||
def __init__(self, md) -> None: ...
|
||||
stashed_nodes: Any
|
||||
parent_map: Any
|
||||
def run(self, tree: Element, ancestors: Incomplete | None = None) -> Element: ...
|
||||
def run(self, tree: Element, ancestors: list[str] | None = None) -> Element: ...
|
||||
|
||||
class PrettifyTreeprocessor(Treeprocessor): ...
|
||||
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
from collections.abc import Iterator
|
||||
from re import Pattern
|
||||
from typing import Any, overload
|
||||
from typing import Any, Generic, TypeVar, overload
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
from markdown.core import Markdown
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
BLOCK_LEVEL_ELEMENTS: Any
|
||||
STX: str
|
||||
ETX: str
|
||||
@@ -16,7 +20,10 @@ TAG_PLACEHOLDER: Any
|
||||
RTL_BIDI_RANGES: Any
|
||||
|
||||
def deprecated(message: str, stacklevel: int = 2): ...
|
||||
def parseBoolValue(value: object, fail_on_errors: bool = True, preserve_none: bool = False) -> bool | None: ...
|
||||
@overload
|
||||
def parseBoolValue(value: str) -> bool: ...
|
||||
@overload
|
||||
def parseBoolValue(value: str | None, fail_on_errors: bool = True, preserve_none: bool = False) -> bool | None: ...
|
||||
def code_escape(text: str) -> str: ...
|
||||
def nearing_recursion_limit() -> bool: ...
|
||||
|
||||
@@ -26,26 +33,32 @@ class Processor:
|
||||
md: Markdown
|
||||
def __init__(self, md: Markdown | None = None) -> None: ...
|
||||
|
||||
class _TagData(TypedDict):
|
||||
tag: str
|
||||
attrs: dict[str, str]
|
||||
left_index: int
|
||||
right_index: int
|
||||
|
||||
class HtmlStash:
|
||||
html_counter: int
|
||||
rawHtmlBlocks: list[str]
|
||||
tag_counter: int
|
||||
tag_data: list[dict[str, Any]]
|
||||
tag_data: list[_TagData]
|
||||
def __init__(self) -> None: ...
|
||||
def store(self, html: str) -> str: ...
|
||||
def reset(self) -> None: ...
|
||||
def get_placeholder(self, key: int) -> str: ...
|
||||
def store_tag(self, tag: str, attrs: list[Any], left_index: int, right_index: int) -> str: ...
|
||||
def store_tag(self, tag: str, attrs: dict[str, str], left_index: int, right_index: int) -> str: ...
|
||||
|
||||
class Registry:
|
||||
class Registry(Generic[_T]):
|
||||
def __init__(self) -> None: ...
|
||||
def __contains__(self, item: object) -> bool: ...
|
||||
def __iter__(self) -> Any: ...
|
||||
def __contains__(self, item: str | _T) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
@overload
|
||||
def __getitem__(self, key: slice) -> Registry: ...
|
||||
def __getitem__(self, key: slice) -> Registry[_T]: ...
|
||||
@overload
|
||||
def __getitem__(self, key: str | int) -> Any: ...
|
||||
def __getitem__(self, key: str | int) -> _T: ...
|
||||
def __len__(self) -> int: ...
|
||||
def get_index_for_name(self, name: str) -> int: ...
|
||||
def register(self, item: Any, name: str, priority: float) -> None: ...
|
||||
def register(self, item: _T, name: str, priority: float) -> None: ...
|
||||
def deregister(self, name: str, strict: bool = True) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user