mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
Various improvements to Markdown stubs (#10972)
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
markdown.extensions.abbr.ABBR_REF_RE
|
||||
markdown.extensions.attr_list.AttrListTreeprocessor.run
|
||||
markdown.extensions.footnotes.DEF_RE
|
||||
markdown.extensions.footnotes.TABBED_RE
|
||||
markdown.extensions.legacy_attrs.LegacyAttrs.run
|
||||
markdown.extensions.toc.TocTreeprocessor.run
|
||||
|
||||
@@ -33,6 +33,8 @@ class Markdown:
|
||||
block_level_elements: list[str]
|
||||
registeredExtensions: list[Extension]
|
||||
ESCAPED_CHARS: list[str]
|
||||
doc_tag: ClassVar[str]
|
||||
stripTopLevelTags: bool
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
from re import Pattern
|
||||
from typing import Any
|
||||
from typing import ClassVar
|
||||
|
||||
from markdown.blockprocessors import BlockProcessor
|
||||
from markdown.extensions import Extension
|
||||
from markdown.inlinepatterns import InlineProcessor
|
||||
|
||||
ABBR_REF_RE: Pattern[str]
|
||||
|
||||
class AbbrExtension(Extension): ...
|
||||
class AbbrPreprocessor(BlockProcessor): ...
|
||||
|
||||
class AbbrPreprocessor(BlockProcessor):
|
||||
RE: ClassVar[Pattern[str]]
|
||||
|
||||
class AbbrInlineProcessor(InlineProcessor):
|
||||
title: Any
|
||||
title: str
|
||||
def __init__(self, pattern: str, title: str) -> None: ...
|
||||
|
||||
def makeExtension(**kwargs) -> AbbrExtension: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from re import Match, Pattern
|
||||
from typing import Any
|
||||
from typing import ClassVar
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
from markdown import blockparser
|
||||
@@ -11,9 +11,11 @@ class AdmonitionExtension(Extension): ...
|
||||
class AdmonitionProcessor(BlockProcessor):
|
||||
CLASSNAME: str
|
||||
CLASSNAME_TITLE: str
|
||||
RE: Pattern[str]
|
||||
RE_SPACES: Any
|
||||
def __init__(self, parser: blockparser.BlockParser): ...
|
||||
RE: ClassVar[Pattern[str]]
|
||||
RE_SPACES: ClassVar[Pattern[str]]
|
||||
current_sibling: Element | None
|
||||
content_indent: int
|
||||
def __init__(self, parser: blockparser.BlockParser) -> None: ...
|
||||
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]: ...
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ class AttrListTreeprocessor(Treeprocessor):
|
||||
BLOCK_RE: Pattern[str]
|
||||
INLINE_RE: Pattern[str]
|
||||
NAME_RE: Pattern[str]
|
||||
def run(self, doc: Element) -> None: ...
|
||||
def assign_attrs(self, elem: Element, attrs: str) -> None: ...
|
||||
def sanitize_name(self, name: str) -> str: ...
|
||||
|
||||
|
||||
@@ -5,19 +5,15 @@ from markdown.treeprocessors import Treeprocessor
|
||||
|
||||
pygments: bool
|
||||
|
||||
def parse_hl_lines(expr): ...
|
||||
def parse_hl_lines(expr: str) -> list[int]: ...
|
||||
|
||||
class CodeHilite:
|
||||
src: Any
|
||||
lang: Any
|
||||
linenums: Any
|
||||
guess_lang: Any
|
||||
css_class: Any
|
||||
style: Any
|
||||
noclasses: Any
|
||||
tab_length: Any
|
||||
hl_lines: Any
|
||||
use_pygments: Any
|
||||
src: str
|
||||
lang: str | None
|
||||
guess_lang: bool
|
||||
use_pygments: bool
|
||||
lang_prefix: str
|
||||
pygments_formatter: Any
|
||||
options: dict[str, Any]
|
||||
def __init__(
|
||||
self,
|
||||
@@ -37,6 +33,7 @@ class CodeHilite:
|
||||
def hilite(self, shebang: bool = True) -> str: ...
|
||||
|
||||
class HiliteTreeprocessor(Treeprocessor):
|
||||
config: dict[str, Any]
|
||||
def code_unescape(self, text: str) -> str: ...
|
||||
|
||||
class CodeHiliteExtension(Extension):
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from collections.abc import Iterable
|
||||
from re import Pattern
|
||||
from typing import Any, ClassVar
|
||||
|
||||
@@ -5,11 +6,16 @@ from markdown.core import Markdown
|
||||
from markdown.extensions import Extension
|
||||
from markdown.preprocessors import Preprocessor
|
||||
|
||||
class FencedCodeExtension(Extension): ...
|
||||
class FencedCodeExtension(Extension):
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
|
||||
class FencedBlockPreprocessor(Preprocessor):
|
||||
FENCED_BLOCK_RE: ClassVar[Pattern[str]]
|
||||
checked_for_deps: bool
|
||||
codehilite_conf: dict[str, Any]
|
||||
use_attr_list: bool
|
||||
bool_options: list[str]
|
||||
def __init__(self, md: Markdown, config: dict[str, Any]) -> None: ...
|
||||
def handle_attrs(self, attrs: Iterable[tuple[str, str]]) -> tuple[str, list[str], dict[str, Any]]: ...
|
||||
|
||||
def makeExtension(**kwargs) -> FencedCodeExtension: ...
|
||||
|
||||
@@ -1,37 +1,44 @@
|
||||
from collections import OrderedDict
|
||||
from re import Pattern
|
||||
from typing import Any
|
||||
from typing import ClassVar
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
from markdown.blockparser import BlockParser
|
||||
from markdown.blockprocessors import BlockProcessor
|
||||
from markdown.core import Markdown
|
||||
from markdown.extensions import Extension
|
||||
from markdown.inlinepatterns import InlineProcessor
|
||||
from markdown.postprocessors import Postprocessor
|
||||
from markdown.treeprocessors import Treeprocessor
|
||||
|
||||
FN_BACKLINK_TEXT: Any
|
||||
NBSP_PLACEHOLDER: Any
|
||||
DEF_RE: Pattern[str]
|
||||
TABBED_RE: Pattern[str]
|
||||
RE_REF_ID: Any
|
||||
FN_BACKLINK_TEXT: str
|
||||
NBSP_PLACEHOLDER: str
|
||||
RE_REF_ID: Pattern[str]
|
||||
|
||||
class FootnoteExtension(Extension):
|
||||
unique_prefix: int
|
||||
found_refs: Any
|
||||
used_refs: Any
|
||||
found_refs: dict[str, int]
|
||||
used_refs: set[str]
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
parser: Any
|
||||
parser: BlockParser
|
||||
md: Markdown
|
||||
footnotes: OrderedDict[str, str]
|
||||
def reset(self) -> None: ...
|
||||
def unique_ref(self, reference: str, found: bool = False) -> str: ...
|
||||
def findFootnotesPlaceholder(self, root: Element): ...
|
||||
def findFootnotesPlaceholder(self, root: Element) -> tuple[Element, Element, bool] | None: ...
|
||||
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 FootnoteBlockProcessor(BlockProcessor):
|
||||
RE: ClassVar[Pattern[str]]
|
||||
footnotes: FootnoteExtension
|
||||
def __init__(self, footnotes: FootnoteExtension) -> None: ...
|
||||
def detectTabbed(self, blocks: list[str]) -> list[str]: ...
|
||||
def detab(self, block: str) -> str: ... # type: ignore[override]
|
||||
|
||||
class FootnoteInlineProcessor(InlineProcessor):
|
||||
footnotes: FootnoteExtension
|
||||
def __init__(self, pattern: str, footnotes: FootnoteExtension) -> None: ...
|
||||
@@ -39,9 +46,9 @@ class FootnoteInlineProcessor(InlineProcessor):
|
||||
class FootnotePostTreeprocessor(Treeprocessor):
|
||||
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: ...
|
||||
def add_duplicates(self, li: Element, duplicates: int) -> None: ...
|
||||
def get_num_duplicates(self, li: Element) -> int: ...
|
||||
def handle_duplicates(self, parent: Element) -> None: ...
|
||||
offset: int
|
||||
|
||||
class FootnoteTreeprocessor(Treeprocessor):
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from re import Pattern
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
from markdown.extensions import Extension
|
||||
from markdown.treeprocessors import Treeprocessor
|
||||
@@ -6,7 +7,8 @@ from markdown.treeprocessors import Treeprocessor
|
||||
ATTR_RE: Pattern[str]
|
||||
|
||||
class LegacyAttrs(Treeprocessor):
|
||||
def handleAttributes(self, el, txt): ...
|
||||
def run(self, doc: Element) -> None: ...
|
||||
def handleAttributes(self, el: Element, txt: str) -> str: ...
|
||||
|
||||
class LegacyAttrExtension(Extension): ...
|
||||
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
from markdown.blockprocessors import BlockProcessor
|
||||
from markdown.extensions import Extension
|
||||
from markdown.postprocessors import RawHtmlPostprocessor
|
||||
|
||||
class MarkdownInHtmlProcessor(BlockProcessor):
|
||||
def parse_element_content(self, element: Element) -> None: ...
|
||||
|
||||
class MarkdownInHTMLPostprocessor(RawHtmlPostprocessor):
|
||||
def stash_to_string(self, text: str | Element) -> str: ...
|
||||
|
||||
class MarkdownInHtmlProcessor(BlockProcessor): ...
|
||||
class MarkdownInHtmlExtension(Extension): ...
|
||||
|
||||
def makeExtension(**kwargs) -> MarkdownInHtmlExtension: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from collections.abc import Sequence
|
||||
from collections.abc import Mapping, Sequence
|
||||
from typing import Any
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
@@ -11,18 +11,18 @@ punctClass: str
|
||||
endOfWordClass: str
|
||||
closeClass: str
|
||||
openingQuotesBase: str
|
||||
substitutions: Any
|
||||
singleQuoteStartRe: Any
|
||||
doubleQuoteStartRe: Any
|
||||
substitutions: Mapping[str, str]
|
||||
singleQuoteStartRe: str
|
||||
doubleQuoteStartRe: str
|
||||
doubleQuoteSetsRe: str
|
||||
singleQuoteSetsRe: str
|
||||
decadeAbbrRe: str
|
||||
openingDoubleQuotesRegex: Any
|
||||
openingDoubleQuotesRegex: str
|
||||
closingDoubleQuotesRegex: str
|
||||
closingDoubleQuotesRegex2: Any
|
||||
openingSingleQuotesRegex: Any
|
||||
closingSingleQuotesRegex: Any
|
||||
closingSingleQuotesRegex2: Any
|
||||
closingDoubleQuotesRegex2: str
|
||||
openingSingleQuotesRegex: str
|
||||
closingSingleQuotesRegex: str
|
||||
closingSingleQuotesRegex2: str
|
||||
remainingSingleQuotesRegex: str
|
||||
remainingDoubleQuotesRegex: str
|
||||
HTML_STRICT_RE: str
|
||||
|
||||
@@ -16,6 +16,7 @@ class TableProcessor(BlockProcessor):
|
||||
separator: str
|
||||
def __init__(self, parser: blockparser.BlockParser, config: dict[str, Any]) -> None: ...
|
||||
|
||||
class TableExtension(Extension): ...
|
||||
class TableExtension(Extension):
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
|
||||
def makeExtension(**kwargs) -> TableExtension: ...
|
||||
|
||||
@@ -27,19 +27,22 @@ def unescape(text: str) -> str: ...
|
||||
def nest_toc_tokens(toc_list: list[_FlatTocToken]) -> list[_TocToken]: ...
|
||||
|
||||
class TocTreeprocessor(Treeprocessor):
|
||||
marker: Any
|
||||
title: Any
|
||||
base_level: Any
|
||||
marker: str
|
||||
title: str
|
||||
base_level: int
|
||||
slugify: Any
|
||||
sep: Any
|
||||
use_anchors: Any
|
||||
anchorlink_class: Any
|
||||
use_permalinks: Any
|
||||
permalink_class: Any
|
||||
permalink_title: Any
|
||||
header_rgx: Any
|
||||
toc_class: Any
|
||||
title_class: str
|
||||
use_anchors: bool
|
||||
anchorlink_class: str
|
||||
use_permalinks: bool
|
||||
permalink_class: str
|
||||
permalink_title: str
|
||||
permalink_leading: bool
|
||||
header_rgx: Pattern[str]
|
||||
toc_top: int
|
||||
toc_bottom: Any
|
||||
toc_bottom: int
|
||||
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: ...
|
||||
@@ -47,6 +50,7 @@ class TocTreeprocessor(Treeprocessor):
|
||||
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: ...
|
||||
def run(self, doc: Element) -> None: ...
|
||||
|
||||
class TocExtension(Extension):
|
||||
TreeProcessorClass: type[TocTreeprocessor]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import re
|
||||
from collections.abc import Collection
|
||||
from typing import Any, ClassVar, NamedTuple
|
||||
from typing import ClassVar, NamedTuple
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
from markdown import util
|
||||
@@ -53,31 +53,33 @@ class Pattern:
|
||||
class InlineProcessor(Pattern):
|
||||
safe_mode: bool
|
||||
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]
|
||||
def handleMatch(self, m: re.Match[str], data: str) -> tuple[Element | str | None, int | None, int | None]: ... # type: ignore[override]
|
||||
|
||||
class SimpleTextPattern(Pattern): ...
|
||||
class SimpleTextInlineProcessor(InlineProcessor): ...
|
||||
class EscapeInlineProcessor(InlineProcessor): ...
|
||||
|
||||
class SimpleTagPattern(Pattern):
|
||||
tag: Any
|
||||
tag: str
|
||||
def __init__(self, pattern: str, tag: str) -> None: ...
|
||||
|
||||
class SimpleTagInlineProcessor(InlineProcessor):
|
||||
tag: Any
|
||||
tag: str
|
||||
def __init__(self, pattern: str, tag: str) -> None: ...
|
||||
|
||||
class SubstituteTagPattern(SimpleTagPattern): ...
|
||||
class SubstituteTagInlineProcessor(SimpleTagInlineProcessor): ...
|
||||
|
||||
class BacktickInlineProcessor(InlineProcessor):
|
||||
ESCAPED_BSLASH: Any
|
||||
ESCAPED_BSLASH: str
|
||||
tag: str
|
||||
def __init__(self, pattern: str) -> None: ...
|
||||
|
||||
class DoubleTagPattern(SimpleTagPattern): ...
|
||||
class DoubleTagInlineProcessor(SimpleTagInlineProcessor): ...
|
||||
class HtmlInlineProcessor(InlineProcessor): ...
|
||||
|
||||
class HtmlInlineProcessor(InlineProcessor):
|
||||
def unescape(self, text: str) -> str: ...
|
||||
def backslash_unescape(self, text: str) -> str: ...
|
||||
|
||||
class AsteriskProcessor(InlineProcessor):
|
||||
PATTERNS: ClassVar[list[EmStrongItem]]
|
||||
@@ -92,17 +94,18 @@ class UnderscoreProcessor(AsteriskProcessor): ...
|
||||
class LinkInlineProcessor(InlineProcessor):
|
||||
RE_LINK: ClassVar[re.Pattern[str]]
|
||||
RE_TITLE_CLEAN: ClassVar[re.Pattern[str]]
|
||||
def getLink(self, data: str, index: int): ...
|
||||
def getText(self, data: str, index: int): ...
|
||||
def getLink(self, data: str, index: int) -> tuple[str, str | None, int, bool]: ...
|
||||
def getText(self, data: str, index: int) -> tuple[str, int, bool]: ...
|
||||
|
||||
class ImageInlineProcessor(LinkInlineProcessor): ...
|
||||
|
||||
class ReferenceInlineProcessor(LinkInlineProcessor):
|
||||
NEWLINE_CLEANUP_RE: ClassVar[re.Pattern[str]]
|
||||
def evalId(self, data: str, index: int, text: str): ...
|
||||
def evalId(self, data: str, index: int, text: str) -> tuple[str | None, int, bool]: ...
|
||||
def makeTag(self, href: str, title: str, text: str) -> Element: ...
|
||||
|
||||
class ShortReferenceInlineProcessor(ReferenceInlineProcessor): ...
|
||||
class ImageReferenceInlineProcessor(ReferenceInlineProcessor): ...
|
||||
class ShortImageReferenceInlineProcessor(ImageReferenceInlineProcessor): ...
|
||||
class AutolinkInlineProcessor(InlineProcessor): ...
|
||||
class AutomailInlineProcessor(InlineProcessor): ...
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from typing import Any
|
||||
|
||||
from markdown.core import Markdown
|
||||
|
||||
from . import util
|
||||
@@ -10,11 +8,4 @@ class Preprocessor(util.Processor):
|
||||
def run(self, lines: list[str]) -> list[str]: ...
|
||||
|
||||
class NormalizeWhitespace(Preprocessor): ...
|
||||
|
||||
class HtmlBlockPreprocessor(Preprocessor):
|
||||
right_tag_patterns: Any
|
||||
attrs_pattern: str
|
||||
left_tag_pattern: Any
|
||||
attrs_re: Any
|
||||
left_tag_re: Any
|
||||
markdown_in_raw: bool
|
||||
class HtmlBlockPreprocessor(Preprocessor): ...
|
||||
|
||||
@@ -13,10 +13,10 @@ class Treeprocessor(util.Processor):
|
||||
def run(self, root: Element) -> Element | None: ...
|
||||
|
||||
class InlineProcessor(Treeprocessor):
|
||||
inlinePatterns: Any
|
||||
ancestors: Any
|
||||
def __init__(self, md) -> None: ...
|
||||
stashed_nodes: Any
|
||||
inlinePatterns: util.Registry[InlineProcessor]
|
||||
ancestors: list[str]
|
||||
def __init__(self, md: Markdown) -> None: ...
|
||||
stashed_nodes: dict[str, Element | str]
|
||||
parent_map: Any
|
||||
def run(self, tree: Element, ancestors: list[str] | None = None) -> Element: ...
|
||||
|
||||
|
||||
@@ -7,18 +7,19 @@ from markdown.core import Markdown
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
BLOCK_LEVEL_ELEMENTS: Any
|
||||
BLOCK_LEVEL_ELEMENTS: list[str]
|
||||
STX: str
|
||||
ETX: str
|
||||
INLINE_PLACEHOLDER_PREFIX: Any
|
||||
INLINE_PLACEHOLDER: Any
|
||||
INLINE_PLACEHOLDER_PREFIX: str
|
||||
INLINE_PLACEHOLDER: str
|
||||
INLINE_PLACEHOLDER_RE: Pattern[str]
|
||||
AMP_SUBSTITUTE: Any
|
||||
HTML_PLACEHOLDER: Any
|
||||
AMP_SUBSTITUTE: str
|
||||
HTML_PLACEHOLDER: str
|
||||
HTML_PLACEHOLDER_RE: Pattern[str]
|
||||
TAG_PLACEHOLDER: Any
|
||||
TAG_PLACEHOLDER: str
|
||||
RTL_BIDI_RANGES: Any
|
||||
|
||||
def get_installed_extensions(): ...
|
||||
def deprecated(message: str, stacklevel: int = 2): ...
|
||||
@overload
|
||||
def parseBoolValue(value: str) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user