citations
langroid/utils/output/citations.py
extract_markdown_references(md_string)
¶
Extracts markdown references (e.g., [^1], [^2]) from a string and returns them as a sorted list of integers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
md_string |
str
|
The markdown string containing references. |
required |
Returns:
Type | Description |
---|---|
list[int]
|
list[int]: A sorted list of unique integers from the markdown references. |
Source code in langroid/utils/output/citations.py
format_footnote_text(content, width=80)
¶
Formats the content part of a footnote (i.e. not the first line that appears right after the reference [^4]) It wraps the text so that no line is longer than the specified width and indents lines as necessary for markdown footnotes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
content |
str
|
The text of the footnote to be formatted. |
required |
width |
int
|
Maximum width of the text lines. |
80
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Properly formatted markdown footnote text. |