mark_link¶
- class atlas_doc_parser.marks.mark_link.MarkLinkAttrs(href: str = REQ, title: str = OPT, id: str = OPT, collection: str = OPT, occurrenceKey: str = OPT)[source]¶
Attributes for
MarkLink.- Parameters:
href – Required. The hyperlink destination URI.
title – Optional. The hyperlink title (HTML title attribute).
id – Optional. String identifier.
collection – Optional. String value for collection.
occurrenceKey – Optional. String value for occurrence key.
- class atlas_doc_parser.marks.mark_link.MarkLink(type: str = 'link', attrs: MarkLinkAttrs = REQ)[source]¶
Sets a hyperlink on text nodes.
The link mark applies exclusively to
textnodes and creates a clickable hyperlink. Thehrefattribute is required and specifies the destination URL.- to_markdown(text: str) str[source]¶
Apply this mark’s formatting to text.
The default implementation returns the input text unchanged. This design reflects the library’s philosophy:
Content extraction over formatting. In the AI era, we convert ADF to Markdown primarily to extract textual content for LLMs, RAG systems, and knowledge bases. Preserving formatting is secondary to preserving content.
When in doubt, preserve content without formatting. If a mark type doesn’t have a standard Markdown equivalent (e.g., background color), we return the raw text rather than inventing custom syntax or losing the content entirely.
Use native Markdown only. We prefer standard Markdown syntax (
**bold**,*italic*). Dialect-specific extensions are avoided.
Subclasses override this method to apply formatting. For example,
MarkStrong.to_markdown("text")returns"**text**".- Parameters:
text – The text content to format.
- Returns:
The formatted text. Default returns text unchanged.