MCPcopy Create free account
hub / github.com/fastapi/fastapi / _construct_markdown_link

Function _construct_markdown_link

scripts/doc_parsing_utils.py:287–307  ·  view source on GitHub ↗

Construct a markdown link, adjusting the URL for the given language code if needed.

(
    url: str,
    text: str,
    title: str | None,
    attributes: str | None,
    lang_code: str,
)

Source from the content-addressed store, hash-verified

285
286
287def _construct_markdown_link(
288 url: str,
289 text: str,
290 title: str | None,
291 attributes: str | None,
292 lang_code: str,
293) -> str:
294 """
295 Construct a markdown link, adjusting the URL for the given language code if needed.
296 """
297 url = _add_lang_code_to_url(url, lang_code)
298
299 if title:
300 link = f'[{text}]({url} "{title}")'
301 else:
302 link = f"[{text}]({url})"
303
304 if attributes:
305 link += f"{{{attributes}}}"
306
307 return link
308
309
310def replace_markdown_links(

Callers 1

replace_markdown_linksFunction · 0.85

Calls 1

_add_lang_code_to_urlFunction · 0.85

Tested by

no test coverage detected