mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
Add third-party commonmark stubs (#5702)
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
"stubs/backports_abc",
|
||||
"stubs/bleach",
|
||||
"stubs/boto",
|
||||
"stubs/commonmark",
|
||||
"stubs/cryptography",
|
||||
"stubs/docutils",
|
||||
"stubs/Flask",
|
||||
|
||||
1
stubs/commonmark/METADATA.toml
Normal file
1
stubs/commonmark/METADATA.toml
Normal file
@@ -0,0 +1 @@
|
||||
version = "0.9"
|
||||
5
stubs/commonmark/commonmark/__init__.pyi
Normal file
5
stubs/commonmark/commonmark/__init__.pyi
Normal file
@@ -0,0 +1,5 @@
|
||||
from commonmark.blocks import Parser as Parser
|
||||
from commonmark.dump import dumpAST as dumpAST, dumpJSON as dumpJSON
|
||||
from commonmark.main import commonmark as commonmark
|
||||
from commonmark.render.html import HtmlRenderer as HtmlRenderer
|
||||
from commonmark.render.rst import ReStructuredTextRenderer as ReStructuredTextRenderer
|
||||
166
stubs/commonmark/commonmark/blocks.pyi
Normal file
166
stubs/commonmark/commonmark/blocks.pyi
Normal file
@@ -0,0 +1,166 @@
|
||||
from typing import Any
|
||||
|
||||
CODE_INDENT: int
|
||||
reHtmlBlockOpen: Any
|
||||
reHtmlBlockClose: Any
|
||||
reThematicBreak: Any
|
||||
reMaybeSpecial: Any
|
||||
reNonSpace: Any
|
||||
reBulletListMarker: Any
|
||||
reOrderedListMarker: Any
|
||||
reATXHeadingMarker: Any
|
||||
reCodeFence: Any
|
||||
reClosingCodeFence: Any
|
||||
reSetextHeadingLine: Any
|
||||
reLineEnding: Any
|
||||
|
||||
def is_blank(s): ...
|
||||
def is_space_or_tab(s): ...
|
||||
def peek(ln, pos): ...
|
||||
def ends_with_blank_line(block): ...
|
||||
def parse_list_marker(parser, container): ...
|
||||
def lists_match(list_data, item_data): ...
|
||||
|
||||
class Block:
|
||||
accepts_lines: Any
|
||||
@staticmethod
|
||||
def continue_(parser: Any | None = ..., container: Any | None = ...) -> None: ...
|
||||
@staticmethod
|
||||
def finalize(parser: Any | None = ..., block: Any | None = ...) -> None: ...
|
||||
@staticmethod
|
||||
def can_contain(t) -> None: ...
|
||||
|
||||
class Document(Block):
|
||||
accepts_lines: bool
|
||||
@staticmethod
|
||||
def continue_(parser: Any | None = ..., container: Any | None = ...): ...
|
||||
@staticmethod
|
||||
def finalize(parser: Any | None = ..., block: Any | None = ...) -> None: ...
|
||||
@staticmethod
|
||||
def can_contain(t): ...
|
||||
|
||||
class List(Block):
|
||||
accepts_lines: bool
|
||||
@staticmethod
|
||||
def continue_(parser: Any | None = ..., container: Any | None = ...): ...
|
||||
@staticmethod
|
||||
def finalize(parser: Any | None = ..., block: Any | None = ...) -> None: ...
|
||||
@staticmethod
|
||||
def can_contain(t): ...
|
||||
|
||||
class BlockQuote(Block):
|
||||
accepts_lines: bool
|
||||
@staticmethod
|
||||
def continue_(parser: Any | None = ..., container: Any | None = ...): ...
|
||||
@staticmethod
|
||||
def finalize(parser: Any | None = ..., block: Any | None = ...) -> None: ...
|
||||
@staticmethod
|
||||
def can_contain(t): ...
|
||||
|
||||
class Item(Block):
|
||||
accepts_lines: bool
|
||||
@staticmethod
|
||||
def continue_(parser: Any | None = ..., container: Any | None = ...): ...
|
||||
@staticmethod
|
||||
def finalize(parser: Any | None = ..., block: Any | None = ...) -> None: ...
|
||||
@staticmethod
|
||||
def can_contain(t): ...
|
||||
|
||||
class Heading(Block):
|
||||
accepts_lines: bool
|
||||
@staticmethod
|
||||
def continue_(parser: Any | None = ..., container: Any | None = ...): ...
|
||||
@staticmethod
|
||||
def finalize(parser: Any | None = ..., block: Any | None = ...) -> None: ...
|
||||
@staticmethod
|
||||
def can_contain(t): ...
|
||||
|
||||
class ThematicBreak(Block):
|
||||
accepts_lines: bool
|
||||
@staticmethod
|
||||
def continue_(parser: Any | None = ..., container: Any | None = ...): ...
|
||||
@staticmethod
|
||||
def finalize(parser: Any | None = ..., block: Any | None = ...) -> None: ...
|
||||
@staticmethod
|
||||
def can_contain(t): ...
|
||||
|
||||
class CodeBlock(Block):
|
||||
accepts_lines: bool
|
||||
@staticmethod
|
||||
def continue_(parser: Any | None = ..., container: Any | None = ...): ...
|
||||
@staticmethod
|
||||
def finalize(parser: Any | None = ..., block: Any | None = ...) -> None: ...
|
||||
@staticmethod
|
||||
def can_contain(t): ...
|
||||
|
||||
class HtmlBlock(Block):
|
||||
accepts_lines: bool
|
||||
@staticmethod
|
||||
def continue_(parser: Any | None = ..., container: Any | None = ...): ...
|
||||
@staticmethod
|
||||
def finalize(parser: Any | None = ..., block: Any | None = ...) -> None: ...
|
||||
@staticmethod
|
||||
def can_contain(t): ...
|
||||
|
||||
class Paragraph(Block):
|
||||
accepts_lines: bool
|
||||
@staticmethod
|
||||
def continue_(parser: Any | None = ..., container: Any | None = ...): ...
|
||||
@staticmethod
|
||||
def finalize(parser: Any | None = ..., block: Any | None = ...) -> None: ...
|
||||
@staticmethod
|
||||
def can_contain(t): ...
|
||||
|
||||
class BlockStarts:
|
||||
METHODS: Any
|
||||
@staticmethod
|
||||
def block_quote(parser, container: Any | None = ...): ...
|
||||
@staticmethod
|
||||
def atx_heading(parser, container: Any | None = ...): ...
|
||||
@staticmethod
|
||||
def fenced_code_block(parser, container: Any | None = ...): ...
|
||||
@staticmethod
|
||||
def html_block(parser, container: Any | None = ...): ...
|
||||
@staticmethod
|
||||
def setext_heading(parser, container: Any | None = ...): ...
|
||||
@staticmethod
|
||||
def thematic_break(parser, container: Any | None = ...): ...
|
||||
@staticmethod
|
||||
def list_item(parser, container: Any | None = ...): ...
|
||||
@staticmethod
|
||||
def indented_code_block(parser, container: Any | None = ...): ...
|
||||
|
||||
class Parser:
|
||||
doc: Any
|
||||
block_starts: Any
|
||||
tip: Any
|
||||
oldtip: Any
|
||||
current_line: str
|
||||
line_number: int
|
||||
offset: int
|
||||
column: int
|
||||
next_nonspace: int
|
||||
next_nonspace_column: int
|
||||
indent: int
|
||||
indented: bool
|
||||
blank: bool
|
||||
partially_consumed_tab: bool
|
||||
all_closed: bool
|
||||
last_matched_container: Any
|
||||
refmap: Any
|
||||
last_line_length: int
|
||||
inline_parser: Any
|
||||
options: Any
|
||||
def __init__(self, options=...) -> None: ...
|
||||
def add_line(self) -> None: ...
|
||||
def add_child(self, tag, offset): ...
|
||||
def close_unmatched_blocks(self) -> None: ...
|
||||
def find_next_nonspace(self) -> None: ...
|
||||
def advance_next_nonspace(self) -> None: ...
|
||||
def advance_offset(self, count, columns) -> None: ...
|
||||
def incorporate_line(self, ln) -> None: ...
|
||||
def finalize(self, block, line_number) -> None: ...
|
||||
def process_inlines(self, block) -> None: ...
|
||||
def parse(self, my_input): ...
|
||||
|
||||
CAMEL_RE: Any
|
||||
1
stubs/commonmark/commonmark/cmark.pyi
Normal file
1
stubs/commonmark/commonmark/cmark.pyi
Normal file
@@ -0,0 +1 @@
|
||||
def main() -> None: ...
|
||||
35
stubs/commonmark/commonmark/common.pyi
Normal file
35
stubs/commonmark/commonmark/common.pyi
Normal file
@@ -0,0 +1,35 @@
|
||||
import html
|
||||
from typing import Any
|
||||
|
||||
HTMLunescape = html.unescape
|
||||
ENTITY: str
|
||||
TAGNAME: str
|
||||
ATTRIBUTENAME: str
|
||||
UNQUOTEDVALUE: str
|
||||
SINGLEQUOTEDVALUE: str
|
||||
DOUBLEQUOTEDVALUE: str
|
||||
ATTRIBUTEVALUE: Any
|
||||
ATTRIBUTEVALUESPEC: Any
|
||||
ATTRIBUTE: Any
|
||||
OPENTAG: Any
|
||||
CLOSETAG: Any
|
||||
HTMLCOMMENT: str
|
||||
PROCESSINGINSTRUCTION: str
|
||||
DECLARATION: Any
|
||||
CDATA: str
|
||||
HTMLTAG: Any
|
||||
reHtmlTag: Any
|
||||
reBackslashOrAmp: Any
|
||||
ESCAPABLE: str
|
||||
reEntityOrEscapedChar: Any
|
||||
XMLSPECIAL: str
|
||||
reXmlSpecial: Any
|
||||
|
||||
def unescape_char(s): ...
|
||||
def unescape_string(s): ...
|
||||
def normalize_uri(uri): ...
|
||||
|
||||
UNSAFE_MAP: Any
|
||||
|
||||
def replace_unsafe_char(s): ...
|
||||
def escape_xml(s): ...
|
||||
3
stubs/commonmark/commonmark/dump.pyi
Normal file
3
stubs/commonmark/commonmark/dump.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
def prepare(obj, topnode: bool = ...): ...
|
||||
def dumpJSON(obj): ...
|
||||
def dumpAST(obj, ind: int = ..., topnode: bool = ...) -> None: ...
|
||||
1
stubs/commonmark/commonmark/entitytrans.pyi
Normal file
1
stubs/commonmark/commonmark/entitytrans.pyi
Normal file
@@ -0,0 +1 @@
|
||||
def _unescape(s: str) -> str: ...
|
||||
65
stubs/commonmark/commonmark/inlines.pyi
Normal file
65
stubs/commonmark/commonmark/inlines.pyi
Normal file
@@ -0,0 +1,65 @@
|
||||
import html
|
||||
from typing import Any
|
||||
|
||||
HTMLunescape = html.unescape
|
||||
ESCAPED_CHAR: Any
|
||||
rePunctuation: Any
|
||||
reLinkTitle: Any
|
||||
reLinkDestinationBraces: Any
|
||||
reEscapable: Any
|
||||
reEntityHere: Any
|
||||
reTicks: Any
|
||||
reTicksHere: Any
|
||||
reEllipses: Any
|
||||
reDash: Any
|
||||
reEmailAutolink: Any
|
||||
reAutolink: Any
|
||||
reSpnl: Any
|
||||
reWhitespaceChar: Any
|
||||
reWhitespace: Any
|
||||
reUnicodeWhitespaceChar: Any
|
||||
reFinalSpace: Any
|
||||
reInitialSpace: Any
|
||||
reSpaceAtEndOfLine: Any
|
||||
reLinkLabel: Any
|
||||
reMain: Any
|
||||
|
||||
def text(s): ...
|
||||
def smart_dashes(chars): ...
|
||||
|
||||
class InlineParser:
|
||||
subject: str
|
||||
brackets: Any
|
||||
pos: int
|
||||
refmap: Any
|
||||
options: Any
|
||||
def __init__(self, options=...) -> None: ...
|
||||
def match(self, regexString): ...
|
||||
def peek(self): ...
|
||||
def spnl(self): ...
|
||||
def parseBackticks(self, block): ...
|
||||
def parseBackslash(self, block): ...
|
||||
def parseAutolink(self, block): ...
|
||||
def parseHtmlTag(self, block): ...
|
||||
def scanDelims(self, c): ...
|
||||
delimiters: Any
|
||||
def handleDelim(self, cc, block): ...
|
||||
def removeDelimiter(self, delim) -> None: ...
|
||||
@staticmethod
|
||||
def removeDelimitersBetween(bottom, top) -> None: ...
|
||||
def processEmphasis(self, stack_bottom) -> None: ...
|
||||
def parseLinkTitle(self): ...
|
||||
def parseLinkDestination(self): ...
|
||||
def parseLinkLabel(self): ...
|
||||
def parseOpenBracket(self, block): ...
|
||||
def parseBang(self, block): ...
|
||||
def parseCloseBracket(self, block): ...
|
||||
def addBracket(self, node, index, image) -> None: ...
|
||||
def removeBracket(self) -> None: ...
|
||||
def parseEntity(self, block): ...
|
||||
def parseString(self, block): ...
|
||||
def parseNewline(self, block): ...
|
||||
def parseReference(self, s, refmap): ...
|
||||
def parseInline(self, block): ...
|
||||
def parseInlines(self, block) -> None: ...
|
||||
parse: Any
|
||||
3
stubs/commonmark/commonmark/main.pyi
Normal file
3
stubs/commonmark/commonmark/main.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
from typing_extensions import Literal
|
||||
|
||||
def commonmark(text: str, format: Literal["html", "json", "ast", "rst"] = ...) -> str: ...
|
||||
51
stubs/commonmark/commonmark/node.pyi
Normal file
51
stubs/commonmark/commonmark/node.pyi
Normal file
@@ -0,0 +1,51 @@
|
||||
from typing import Any
|
||||
|
||||
reContainer: Any
|
||||
|
||||
def is_container(node): ...
|
||||
|
||||
class NodeWalker:
|
||||
current: Any
|
||||
root: Any
|
||||
entering: bool
|
||||
def __init__(self, root) -> None: ...
|
||||
def __next__(self): ...
|
||||
next: Any
|
||||
def __iter__(self): ...
|
||||
def nxt(self): ...
|
||||
def resume_at(self, node, entering) -> None: ...
|
||||
|
||||
class Node:
|
||||
t: Any
|
||||
parent: Any
|
||||
first_child: Any
|
||||
last_child: Any
|
||||
prv: Any
|
||||
nxt: Any
|
||||
sourcepos: Any
|
||||
last_line_blank: bool
|
||||
last_line_checked: bool
|
||||
is_open: bool
|
||||
string_content: str
|
||||
literal: Any
|
||||
list_data: Any
|
||||
info: Any
|
||||
destination: Any
|
||||
title: Any
|
||||
is_fenced: bool
|
||||
fence_char: Any
|
||||
fence_length: int
|
||||
fence_offset: Any
|
||||
level: Any
|
||||
on_enter: Any
|
||||
on_exit: Any
|
||||
def __init__(self, node_type, sourcepos) -> None: ...
|
||||
def pretty(self) -> None: ...
|
||||
def normalize(self) -> None: ...
|
||||
def is_container(self): ...
|
||||
def append_child(self, child) -> None: ...
|
||||
def prepend_child(self, child) -> None: ...
|
||||
def unlink(self) -> None: ...
|
||||
def insert_after(self, sibling) -> None: ...
|
||||
def insert_before(self, sibling) -> None: ...
|
||||
def walker(self): ...
|
||||
1
stubs/commonmark/commonmark/normalize_reference.pyi
Normal file
1
stubs/commonmark/commonmark/normalize_reference.pyi
Normal file
@@ -0,0 +1 @@
|
||||
def normalize_reference(string): ...
|
||||
0
stubs/commonmark/commonmark/render/__init__.pyi
Normal file
0
stubs/commonmark/commonmark/render/__init__.pyi
Normal file
37
stubs/commonmark/commonmark/render/html.pyi
Normal file
37
stubs/commonmark/commonmark/render/html.pyi
Normal file
@@ -0,0 +1,37 @@
|
||||
from typing import Any
|
||||
|
||||
from commonmark.render.renderer import Renderer
|
||||
|
||||
reUnsafeProtocol: Any
|
||||
reSafeDataProtocol: Any
|
||||
|
||||
def potentially_unsafe(url): ...
|
||||
|
||||
class HtmlRenderer(Renderer):
|
||||
disable_tags: int
|
||||
last_out: str
|
||||
options: Any
|
||||
def __init__(self, options=...) -> None: ...
|
||||
def escape(self, text): ...
|
||||
def tag(self, name, attrs: Any | None = ..., selfclosing: Any | None = ...) -> None: ...
|
||||
def text(self, node, entering: Any | None = ...) -> None: ...
|
||||
def softbreak(self, node: Any | None = ..., entering: Any | None = ...) -> None: ...
|
||||
def linebreak(self, node: Any | None = ..., entering: Any | None = ...) -> None: ...
|
||||
def link(self, node, entering) -> None: ...
|
||||
def image(self, node, entering) -> None: ...
|
||||
def emph(self, node, entering) -> None: ...
|
||||
def strong(self, node, entering) -> None: ...
|
||||
def paragraph(self, node, entering) -> None: ...
|
||||
def heading(self, node, entering) -> None: ...
|
||||
def code(self, node, entering) -> None: ...
|
||||
def code_block(self, node, entering) -> None: ...
|
||||
def thematic_break(self, node, entering) -> None: ...
|
||||
def block_quote(self, node, entering) -> None: ...
|
||||
def list(self, node, entering) -> None: ...
|
||||
def item(self, node, entering) -> None: ...
|
||||
def html_inline(self, node, entering) -> None: ...
|
||||
def html_block(self, node, entering) -> None: ...
|
||||
def custom_inline(self, node, entering) -> None: ...
|
||||
def custom_block(self, node, entering) -> None: ...
|
||||
def out(self, s) -> None: ...
|
||||
def attrs(self, node): ...
|
||||
7
stubs/commonmark/commonmark/render/renderer.pyi
Normal file
7
stubs/commonmark/commonmark/render/renderer.pyi
Normal file
@@ -0,0 +1,7 @@
|
||||
class Renderer:
|
||||
buf: str
|
||||
last_out: str
|
||||
def render(self, ast): ...
|
||||
def lit(self, s) -> None: ...
|
||||
def cr(self) -> None: ...
|
||||
def out(self, s) -> None: ...
|
||||
26
stubs/commonmark/commonmark/render/rst.pyi
Normal file
26
stubs/commonmark/commonmark/render/rst.pyi
Normal file
@@ -0,0 +1,26 @@
|
||||
from typing import Any
|
||||
|
||||
from commonmark.render.renderer import Renderer
|
||||
|
||||
class ReStructuredTextRenderer(Renderer):
|
||||
indent_char: Any
|
||||
indent_length: int
|
||||
def __init__(self, indent_char: str = ...) -> None: ...
|
||||
def lit(self, s): ...
|
||||
def cr(self) -> None: ...
|
||||
def indent_lines(self, literal, indent_length: int = ...): ...
|
||||
def document(self, node, entering) -> None: ...
|
||||
def softbreak(self, node, entering) -> None: ...
|
||||
def linebreak(self, node, entering) -> None: ...
|
||||
def text(self, node, entering) -> None: ...
|
||||
def emph(self, node, entering) -> None: ...
|
||||
def strong(self, node, entering) -> None: ...
|
||||
def paragraph(self, node, entering) -> None: ...
|
||||
def link(self, node, entering) -> None: ...
|
||||
def image(self, node, entering) -> None: ...
|
||||
def code(self, node, entering) -> None: ...
|
||||
def code_block(self, node, entering) -> None: ...
|
||||
def list(self, node, entering) -> None: ...
|
||||
def item(self, node, entering) -> None: ...
|
||||
def block_quote(self, node, entering) -> None: ...
|
||||
def heading(self, node, entering) -> None: ...
|
||||
Reference in New Issue
Block a user