11import re
22from typing import List , Union
3+
34from pydantic import validate_call
5+
46from jsondoc .convert .utils import get_rich_text_from_block
57from jsondoc .models .block .base import BlockBase
68from jsondoc .models .block .types .code import CodeBlock
1921from jsondoc .models .shared_definitions import Annotations
2022from jsondoc .serialize import load_jsondoc , load_page
2123
22-
2324convert_heading_re = re .compile (r"convert_heading_(\d+)" )
2425line_beginning_re = re .compile (r"^" , re .MULTILINE )
2526whitespace_re = re .compile (r"[\t ]+" )
@@ -60,7 +61,6 @@ def chomp(text):
6061
6162
6263class JsonDocToMarkdownConverter (object ):
63-
6464 class DefaultOptions :
6565 autolinks = True
6666 bullets = "*+-" # An iterable of bullet types.
@@ -90,8 +90,7 @@ def __init__(self, **options):
9090 self .options .update (options )
9191 if self .options ["strip" ] is not None and self .options ["convert" ] is not None :
9292 raise ValueError (
93- "You may specify either tags to strip or tags to"
94- " convert, but not both."
93+ "You may specify either tags to strip or tags to convert, but not both."
9594 )
9695
9796 def __getattr__ (self , attr ):
@@ -111,7 +110,6 @@ def convert_tag(block, convert_as_inline):
111110
112111 @validate_call
113112 def convert (self , obj : str | dict | BlockBase | List [BlockBase ] | Page ) -> str :
114-
115113 if isinstance (obj , (str , dict )):
116114 jsondoc = load_jsondoc (obj )
117115 else :
@@ -145,7 +143,6 @@ def _get_children_content(self, block: BlockBase, convert_as_inline: bool) -> st
145143
146144 @validate_call
147145 def convert_block (self , block : BlockBase , convert_as_inline : bool ) -> str :
148-
149146 type_ = block .type
150147 convert_fn = getattr (self , f"convert_{ type_ } _block" , None )
151148
0 commit comments