Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
mdfy Documentation
Logo

Getting Started

  • Getting Started

User Guide

  • User Guide
  • Examples

API Reference

  • mdfy package
    • mdfy.elements package
      • MdCode
      • MdHeader
      • MdHorizontal
      • MdImage
      • MdLink
      • MdList
      • MdQuote
      • TableData
      • MdTable
      • MdText
    • Mdfier
  • mdfy.elements package
    • MdCode
    • MdHeader
    • MdHorizontal
    • MdImage
    • MdLink
    • MdList
    • MdQuote
    • TableData
    • MdTable
    • MdText
Back to top
View this page
Edit this page
class mdfy.elements.link.MdLink(url: str, text: str = '', title: str | None = None)[source]¶

Bases: MdElement

Represents a Markdown link.

url¶

The URL of the link.

Type:

str

text¶

The display text for the link.

Type:

str

title¶

The title attribute for the link.

Type:

str

Examples

>>> from mdfy.elements import MdLink
>>>
>>> link = MdLink("https://www.example.com", "example")
>>> print(link)
[example](https://www.example.com)
>>>
>>> link = MdLink("https://www.example.com", "example", title="example")
>>> print(link)
[example](https://www.example.com "example")
__str__() → str[source]¶

Returns a string representation of the link in Markdown format.

Returns:

String representation of the link.

Return type:

str

Warning

If the link URL is None, it will log a warning and set the URL to an empty string.

Next
<no title>
Previous
<no title>
Copyright © 2023, k-ush
Made with Sphinx and @pradyunsg's Furo
On this page
  • MdLink
    • MdLink.url
    • MdLink.text
    • MdLink.title
    • MdLink.__str__()