@@ -90,16 +90,14 @@ def _render_cmd(code: str) -> str:
9090
9191
9292class Renderer (markdown_code_blocks .CodeRenderer ):
93- def link (
94- self , link : str , text : str | None , title : str | None ,
95- ) -> str :
96- if link .startswith ('_#' ):
97- a_id = link .removeprefix ('_#' )
93+ def link (self , text : str , url : str , title : str | None = None ) -> str :
94+ if url .startswith ('_#' ):
95+ a_id = url .removeprefix ('_#' )
9896 return f'<a id="{ a_id } " href="#{ a_id } ">{ text } </a>'
99- elif link .startswith ('__#' ):
100- return f'<a name="{ link .removeprefix ("__#" )} "></a>'
97+ elif url .startswith ('__#' ):
98+ return f'<a name="{ url .removeprefix ("__#" )} "></a>'
10199 else :
102- return super ().link (link , text , title )
100+ return super ().link (text , url , title )
103101
104102 def heading (self , text : str , level : int ) -> str :
105103 match = ID_RE .search (text )
@@ -121,16 +119,11 @@ def codespan(self, text: str) -> str:
121119 else :
122120 return super ().codespan (text )
123121
124- def image (
125- self ,
126- src : str ,
127- alt : str = '' ,
128- title : str | None = None ,
129- ) -> str :
122+ def image (self , text : str , url : str , title : str | None = None ) -> str :
130123 return (
131124 f'<img '
132- f' src="{ html .escape (src )} "'
133- f' alt="{ html .escape (alt )} "'
125+ f' src="{ html .escape (url )} "'
126+ f' alt="{ html .escape (text )} "'
134127 f' class="img-fluid img-thumbnail"'
135128 f'>'
136129 )
0 commit comments