What does the Markdown Footnote & Reference Link Generator do?
The Markdown Footnote & Reference Link Generator is a documentation formatting tool that cleans up cluttered inline links ([Text](url)) by converting them into elegant reference-style links ([Text][1]) and aggregating an alphabetical or numeric dictionary of URLs at the document footer. It also indexes and sequentially renumbers GitHub Flavored Markdown (GFM) footnotes ([^1]), resolving broken citation chains and orphaned definitions.
Developers, academic researchers, and technical writers use this utility to create clean, readable Markdown documents and ensure link integrity across documentation wikis and release notes.
Core Reference & Footnote Rules
Markdown supports two distinct referencing paradigms:
- Reference-Style Links (
[Text][id]): Keeps raw paragraph text legible by replacing long, complex URLs with concise numeric indices ([1]) or alphanumeric slugs ([api-reference]), consolidating all target URLs at the end of the file ([1]: https://example.com). - Footnote Citations (
[^1]): Injects superscript citation marks that jump directly to footnote explanations at the document footer ([^1]: Detailed explanatory note.). - Citation Integrity Verification: Detects missing footnote definitions where citations exist in body copy without corresponding footer notes, and flags orphaned definitions that are never cited.
How to use the tool?
- Paste Markdown Document: Paste your raw Markdown document containing inline URLs or footnote callouts into the input editor.
- Select Conversion Mode: Choose between converting inline links to references, sequentially renumbering footnotes, or executing both operations simultaneously.
- Choose Reference ID Format: Select Numeric Index (
[1],[2]) or Descriptive Slugs ([docs],[github-repo]). - Format & Clean: Click 📑 Clean & Format Markdown to generate the formatted document, inspect citation validation metrics, and copy or download the clean Markdown file.
REST API Integration
Blueutils provides a free REST API endpoint (POST https://blueutils.com/api/markdown/footnote-generator) for programmatic integration.
API Request Parameters
| Name | Type | Description | Example |
|---|---|---|---|
rawText |
String | Raw Markdown text to format. | "# Doc\n\nCheck [site](https://blueutils.com)." |
mode |
String | Operation mode ("both", "convertInline", "renumberFootnotes"). |
"both" |
refStyle |
String | Reference ID format ("numeric", "named"). |
"numeric" |
API Request Payload Examples
cURL
curl -X POST https://blueutils.com/api/markdown/footnote-generator \
-H "Content-Type: application/json" \
-d '{
"rawText": "# My Document\n\nBlueutils[^priv] is fast[^perf]. Visit [Docs](https://blueutils.com).\n\n[^perf]: Fast.\n[^priv]: Private.",
"mode": "both",
"refStyle": "numeric"
}'Python
import requests
url = "https://blueutils.com/api/markdown/footnote-generator"
payload = {
"rawText": "# My Document\n\nBlueutils[^priv] is fast[^perf]. Visit [Docs](https://blueutils.com).\n\n[^perf]: Fast.\n[^priv]: Private.",
"mode": "both",
"refStyle": "numeric"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String jsonPayload = "{\"rawText\":\"# Title\\n\\nVisit [Docs](https://blueutils.com).\",\"mode\":\"convertInline\"}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://blueutils.com/api/markdown/footnote-generator"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}API Response Parameters
| Name | Type | Description | Example |
|---|---|---|---|
isValid |
Boolean | Indicates whether formatting succeeded. | true |
formattedDocument |
String | Complete Markdown document with tidy references. | "# Title\n\nVisit [Docs][1]...\n\n[1]: ..." |
referenceCount |
Number | Total reference links generated. | 1 |
footnoteCount |
Number | Total footnotes renumbered and validated. | 2 |
missingFootnoteCount |
Number | Count of citations missing a footer definition. | 0 |
orphanedFootnoteCount |
Number | Count of unreferenced footnote definitions. | 0 |
API Response Payload Examples
Success Response (HTTP 200 OK)
{
"isValid": true,
"formattedDocument": "# My Document\n\nBlueutils[^1] is fast[^2]. Visit [Docs][1].\n\n[^1]: Private.\n[^2]: Fast.\n\n[1]: https://blueutils.com",
"referenceCount": 1,
"footnoteCount": 2,
"missingFootnoteCount": 0,
"orphanedFootnoteCount": 0
}Validation Failure Response (HTTP 400 Bad Request)
{
"isValid": false,
"error": "Please enter or paste Markdown text containing links or footnotes to format."
}Rate Limit Exceeded Response (HTTP 429 Too Many Requests)
{
"error": "API rate limit exceeded. Please wait or contact support@blueutils.com."
}Why use an API to format footnotes and reference links?
Integrating the Markdown Footnote Generator API into documentation linters, static site generators, and CI/CD pipelines provides several practical advantages:
- Automated PR Linters & Document Tidying: Automatically format pull request documentation to adhere to reference-link style guides without manual developer intervention.
- Deterministic Numbering for LLM Outputs: Language models often generate disorganized citation numbers (
[^1],[^3],[^2]) with mismatched footer entries. Passing generated text through this API deterministically repairs the citation order. - Broken Citation Prevention: Detect missing definitions in CI build steps before documentation is deployed to production.
Native Usage
How to manage Markdown footnotes and reference links locally using native command-line utilities and scripts:
Windows (PowerShell Reference Link Scanner)
# Extract inline links into a bottom reference dictionary using PowerShell
$md = Get-Content README.md -Raw
$i = 1; $refs = @()
$cleaned = [regex]::Replace($md, '(?<!!)\[([^\]]+)\]\((https?://[^\s)]+)\)', {
param($m)
$refs += "[$i]: $($m.Groups[2].Value)"
"[$($m.Groups[1].Value)][$($i++)]"
})
"$cleaned`n`n" + ($refs -join "`n")Linux / Unix (Sed & AWK CLI Pipeline)
# Convert inline links to reference links using AWK
awk '
{
while (match($0, /\[([^]]+)\]\((https?:\/\/[^)]+)\)/, m)) {
ref_count++;
refs[ref_count] = "[" ref_count "]: " m[2];
sub(/\[([^]]+)\]\((https?:\/\/[^)]+)\)/, "[" m[1] "][" ref_count "]");
}
print $0;
}
END {
print "\n";
for (i = 1; i <= ref_count; i++) print refs[i];
}' README.mdPython (Standard Library re Link Formatter)
import re
with open("README.md", "r", encoding="utf-8") as f:
text = f.read()
refs = []
def replace_link(match):
idx = len(refs) + 1
refs.append(f"[{idx}]: {match.group(2)}")
return f"[{match.group(1)}][{idx}]"
clean_text = re.sub(r'(?<!!)\[([^\]]+)\]\((https?://[^\s)]+)\)', replace_link, text)
print(f"{clean_text}\n\n" + "\n".join(refs))Java (Native Standard Library Reference Link Parser)
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class MarkdownFootnotes {
public static void main(String[] args) throws Exception {
String content = Files.readString(Path.of("README.md"));
Pattern pattern = Pattern.compile("(?<!!)\\[([^\\]]+)\\]\\((https?://[^\\s)]+)\\)");
Matcher matcher = pattern.matcher(content);
List<String> refs = new ArrayList<>();
StringBuilder sb = new StringBuilder();
while (matcher.find()) {
int idx = refs.size() + 1;
refs.add("[" + idx + "]: " + matcher.group(2));
matcher.appendReplacement(sb, "[$1][" + idx + "]");
}
matcher.appendTail(sb);
System.out.println(sb.toString() + "\n\n" + String.join("\n", refs));
}
}