Chunk a Note for Your AI and Its Footnotes Lose Their Sources
"Taking excerpts of text can be problematic, as key pieces may not be explicit in a local window." — Choi et al., Transactions of the Association for Computational Linguistics, 20211
When a Markdown note goes through a text splitter, footnote markers — [^1], [^author] — travel with the paragraphs they annotate. The definitions — the actual URLs — do not. They sit at the end of the file. Once the note outgrows one chunk, the two end up in separate chunks: a claim with no source.
This is not a bug in LangChain or LlamaIndex. Neither library claims to handle Markdown footnotes. The source for both confirms it: a grep for footnote across every relevant parser file in langchain-text-splitters 1.1.3 and llama-index-core 0.14.26 returns zero hits in any footnote-aware context.2 The splitter does not know that [^author] and [^author]: https://… are a pair. It splits on size or structure, and the pair breaks.
This post measures how often that happens across six splitter configurations and three notes of varying length, then works through three fixes — a plain-text habit, a pandoc pre-processing pass on a copy, and an eleven-line Python pre-pass — ordered by how much they cost and how well they work.
Why Markdown footnotes are a split-time hazard
Markdown footnotes are physically separated by design. The marker [^n] appears inline, next to the claim. The definition [^n]: … can sit anywhere in the file — after the paragraph, after the section, or at the very end. In practice, most writers and tools place definitions at the bottom.
GitHub's documentation states this directly: "The position of a footnote in your Markdown does not influence where the footnote will be rendered. You can write a footnote right after your reference to the footnote, and the footnote will still render at the bottom of the Markdown."3 That is good advice for a human reader. For a chunker, it is a recipe for separation.
Pandoc's manual makes the same point about placement: "The footnotes themselves need not be placed at the end of the document. They may appear anywhere except inside other block elements (lists, block quotes, tables, etc.)."4 The standard explicitly allows co-location. Most files do not use it.
The result is a file layout where every definition accumulates at the tail. As the note grows — more sources, more sections — the gap between a claim and its definition widens. When the splitter encounters that file, it cuts on size or on heading boundaries, and that gap becomes a chunk boundary.
flowchart LR
note[Note file] --> splitter[Text splitter]
splitter --> c1[Chunk 1 - marker only]
splitter --> cn[Chunk N - definition only]
Figure 1 — How a note's footnote pair splits across chunks. The marker [^src] travels with the paragraph it annotates; the definition [^src]: URL accumulates at the tail. Any chunk boundary that falls between them severs the pair — a gap that widens as the note grows.
This is the same mechanism that separates table headers from their data rows when a table straddles a chunk boundary. That post owns the generic pattern; this one is the citation case.
The numbers: how many markers lose their source
Across six splitter configurations and three notes of varying length — 3.3 KB, 2.0 KB, and 9.2 KB — 204 of 252 footnote markers landed in a chunk that did not contain their definition. No configuration that split a note into multiple chunks preserved all pairs.5
The measurement uses langchain-text-splitters 1.1.3 and llama-index-core 0.14.26 (versions current as of 2026-11-14). Each library has about 41 million and 5.8 million monthly downloads respectively on PyPI.6 7
The orphan metric is strict: a marker occurrence [^x] is orphaned when the definition's URL is absent from the same chunk. The notes:
- Note A (3.3 KB, 9 footnotes) — the canonical test note, comparable to a focused reading-notes file.
- Note B (2.0 KB, 8 footnotes) — a shorter note with named labels, a reused footnote, and reference links.
- Note C (9.2 KB, 24 footnotes) — a longer research note, representative of a note that has grown over time.
Results across all three notes, six configurations, as written:
| Config | Chunks (A) | Orphaned A | Orphaned B | Orphaned C |
|---|---|---|---|---|
MarkdownHeaderTextSplitter([#,##]) | 2 | 6/9 | 5/8 | 24/24 |
RecursiveCharacterTextSplitter(500,50) | 10 | 9/9 | 8/8 | 24/24 |
MarkdownTextSplitter(1000,100) | 4 | 8/9 | 7/8 | 24/24 |
MarkdownNodeParser() | 3 | 6/9 | 5/8 | 24/24 |
SentenceSplitter() defaults (1024 tok) | 1 | 0/9 | 0/8 | 27/30 |
SentenceSplitter(256,20) | 4 | 9/9 | 6/8 | 27/30 |
The heading-based splitters (MarkdownHeaderTextSplitter, MarkdownNodeParser) fail at any note length with two or more sections, because the last section of the note holds all the definitions. The character-based splitters fail once the note outgrows one chunk. SentenceSplitter at defaults kept notes A and B in a single chunk — zero orphans — but note C, at 9,207 characters, produced 27 orphaned markers out of 30 at those same defaults.
The research literature on retrieval puts this problem in a broader frame. As Choi et al. wrote in a 2021 TACL study on decontextualization: "Taking excerpts of text can be problematic, as key pieces may not be explicit in a local window."1 The retrieved unit needs to be self-contained. A claim without its source is not.
The threshold: short notes are safe at defaults
The 204-of-252 figure comes from configurations with small chunk sizes. At library defaults — chunk_size=4000, chunk_overlap=200 for RecursiveCharacterTextSplitter and MarkdownTextSplitter; DEFAULT_CHUNK_SIZE=1024 tokens for SentenceSplitter — short notes fit in a single chunk and produce zero orphans.8 The problem starts the moment a note outgrows one chunk, not before.
Notes A and B, at 3.3 KB and 2.0 KB, fit entirely within those defaults. Zero orphans. The definitions chunk co-locates with every marker because there is only one chunk.
Note C does not fit. At defaults, RecursiveCharacterTextSplitter orphans 24 of 24 definitions; MarkdownTextSplitter orphans 24 of 24; SentenceSplitter orphans 27 of 30 (the overlap causes some markers to repeat across chunks). The behavior emerges the moment the note spills into a second chunk.
The practical implication: if your notes are short and tightly scoped, the default configuration of either library is likely safe. If you write long, richly sourced notes — the kind that accumulate citations across multiple reading sessions — the problem will appear.
Fix 1 — Keep the source next to the claim
The cheapest fix requires no script and no tooling: place each footnote definition immediately after the paragraph that cites it. Write the source on the line below the claim, before the next paragraph begins. The chunk boundary can still fall elsewhere, but it no longer runs between the claim and its URL.
The proposal reduced incident rates by 34%.[^klein]
[^klein]: Klein, G. (1993). A recognition-primed decision model of rapid decision making.
In G.A. Klein et al. (Eds.), *Decision making in action* (pp. 138–147). Ablex. https://doi.org/…
The follow-up study found the effect held across domains.[^weick]
[^weick]: Weick, K.E. (1988). Enacted sensemaking in crisis situations.
*Journal of Management Studies*, 25(4), 305–317. https://doi.org/…
This matches what the syntax guide describes and what GitHub's rendering engine already allows — moving the definition changes nothing the reader sees on GitHub or in a rendered view.3 The claim and its source now appear in the same window, so any chunk boundary that falls between sections is unlikely to separate them.
The practical limit: a very long definition can still straddle a boundary if it spans more lines than the chunk overlap covers. The fix works because it shortens the gap, not because it eliminates every possible boundary.
How you structure a note is its AI retrieval covers heading architecture for retrieval; this is the complementary rule for citation architecture inside a section.
Fix 2 — Pandoc block-placement pass, on a copy
If your notes already have definitions at the bottom, pandoc can move them to block-placement — immediately after the block that cites them — in a single command. Run it on a copy of the note fed to the splitter, never on the vault file itself.
pandoc -f markdown -t markdown-smart \
--reference-location=block \
--wrap=preserve \
note.md -o chunk-input/note.md
The --reference-location=block option moves each definition to follow the block that contains its marker. Pandoc's manual: "Specify whether footnotes (and references, if reference-links is set) are placed at the end of the current (top-level) block, the current section, or the document. The default is document."9
After this pass, the same six configs produced 13 of 251 orphaned markers — down from 204.10 The heading-based splitters (MarkdownHeaderTextSplitter, MarkdownNodeParser) reached 0 on all three notes because the definitions now sit inside the section that uses them.
Why only on a copy. Pandoc's markdown-to-markdown conversion has side effects that make it unsuitable as an in-place vault editor:11
- Named labels are renumbered sequentially (
[^walker]becomes[^1]). - A label cited in two paragraphs is duplicated into two separate footnotes.
- Text is hard-wrapped at 72 columns (unless
--wrap=preserve). - Em dashes become
---unlessmarkdown-smartis specified. - Wikilinks (
[[title]]) are escaped to\[\[title\]\]. - Obsidian callouts (
> [!note]) are escaped. - Bullet markers change from
*to-. - YAML frontmatter is dropped without
-s, or re-serialized with-s.
Running a formatter over your vault rewrites your notes in ways that are hard to reverse. Use this command on a copy that lives only in your chunker's input directory, not in the note itself.
Fix 3 — Inline pre-pass in eleven lines of Python
A stdlib-only pre-pass that copies each definition next to its first-use marker scored 1 of 250 orphaned markers — versus 13 of 251 after the pandoc pass.12 It touches nothing but footnote definitions, leaves every other aspect of the file intact, and runs without any installed dependencies.
# inline_fn.py — place each [^label]: definition after its first-use paragraph
# Run on a copy. Tested on 3 notes (3.3 KB, 2.0 KB, 9.2 KB).
import re, sys
text = open(sys.argv[1]).read()
defs = dict(re.findall(r'\[\^([^\]]+)\]:\s*(.*?)(?=\n\[\^|\Z)', text, re.S))
text = re.sub(r'\n\[\^[^\]]+\]:.*?(?=\n\[\^|\Z)', '', text, flags=re.S)
def inject(m):
label = m.group(1)
if label in defs:
val = defs.pop(label)
return f'[^{label}]\n\n[^{label}]: {val.strip()}'
return m.group(0)
text = re.sub(r'\[\^([^\]]+)\]', inject, text)
print(text)
Stated limits: the script does not skip fenced code blocks, so a [^label] inside a code example is treated as a live marker. It was tested on three notes only. A very long definition can still straddle a chunk boundary — that is the residual 1-in-250.
The residual has one cause regardless of which fix you use: a chunk boundary falls between a paragraph and the definition placed directly under it. The shorter and more compact each definition, the less surface area it presents to a boundary. Keep the source brief and on the claim's own line — the closer it sits, the fewer boundaries can interrupt it.
Trade-offs
Every fix here addresses chunk contents, not retrieval quality. The claim is structural — the chunk that holds the citation marker does not hold its source URL — and each fix verifies against that criterion. What it does not show is whether a retriever would have fetched the right context anyway, or how a model's answer changes.
What this measurement does and does not show. Every number above is a count of text in chunks, not a count of model answers. The claim is "the chunk that holds the citation marker does not hold its source URL," not "the model answers incorrectly." A retriever that fetches k chunks may happen to include the definitions chunk alongside the claim chunk — but nothing ties the two together, and the definitions chunk is a list of bare URLs with no claim text, so its similarity to a user query about the claim is incidental. The fix addresses the structural problem; it does not guarantee answer quality.13
Bigger chunk size is a partial fix. At the library defaults (chunk_size 4000 for LangChain, 1024 tokens for LlamaIndex), short notes fit in one chunk and produce zero orphans. For longer notes, raising the chunk size delays the problem rather than solving it. Note C at 9,207 characters exceeded the LangChain 4000-character default and orphaned 24 of 24 definitions. A note that continues to grow will eventually outgrow any fixed chunk size.
Pandoc versus the pre-pass. Pandoc's output is cleaner prose Markdown and handles edge cases the eleven-line script does not. The pre-pass wins on orphan rate (1/250 vs 13/251) but is a receipt script, not a hardened tool. For a production pipeline, pandoc with --reference-location=block on a copy is the more defensible choice. For a quick local experiment, the pre-pass is fast.
MarkdownNodeParser and tilde fences. MarkdownNodeParser in llama-index-core 0.14.26 tracks code fences by lines starting with three backticks. A # comment inside a tilde-fenced (~~~) block may be interpreted as a heading, producing an unexpected node split. If your notes use tilde fences, check the loader post for the addendum on this behavior. It does not affect the footnote results above, but it is worth knowing before you choose this splitter.
Frequently Asked Questions
The questions below represent the most common points of confusion when chunking Markdown notes that use [^n] footnote syntax. Each answer follows the same principle: a marker and its definition are only useful together, and anything that separates them — a chunk boundary, a tool that moves one and not the other — breaks the pair.
Why does my RAG answer repeat the claim from my notes but not cite the source?
The claim marker [^n] traveled with the paragraph it annotates. The definition [^n]: https://… stayed with a later chunk — typically the final chunk that holds all end-of-file definitions. The retriever returned the claim chunk; the definition chunk did not make the top-k. The claim arrived in the model's context without its URL.
How do I chunk Markdown notes that use footnotes?
In order of cost: (1) place each definition immediately below its paragraph when you write the note; (2) use the inline_fn.py pre-pass on a copy before chunking; (3) run pandoc -f markdown -t markdown-smart --reference-location=block --wrap=preserve note.md -o chunk-input/note.md on a copy. All three reduce orphaned markers to near-zero without changing the vault file.
Does MarkdownHeaderTextSplitter handle footnotes?
No. Its source code contains no footnote-aware logic.2 It splits on lines that begin with # characters, producing one chunk per section. All footnote definitions — which live at the end of the file — land in the final chunk, separated from every marker in every earlier section.
Is a bigger chunk size a fix?
Only while the note fits in one chunk. At langchain-text-splitters defaults (chunk_size=4000), notes under about 4,000 characters fit in one chunk and produce zero orphans. A 9.2 KB note at those same defaults orphaned 24 of 24 definitions.8 Any note that grows past the chunk ceiling runs into the same problem.
Will moving footnote definitions change how my note looks? On GitHub, no. GitHub's documentation explicitly states that footnote position does not affect rendering — the footnote always appears at the bottom of the rendered page.3 Obsidian's rendering behavior for mid-note definitions was not tested; use the in-app preview to verify before committing the change to your vault.
How do I check which chunks my notes produce?
Run the note through the splitter and print each chunk's text, then scan for [^x] markers. If a marker appears without its matching [^x]: line in the same chunk, it is orphaned. The chunk.py harness in the receipt bundle does exactly this check and prints a count per configuration.
The source for a claim is not decoration. It is the unit of trust the retrieval context carries to the model — and to anyone reading a cited answer. Putting the definition next to the paragraph costs one extra line. Finding out it was missing costs considerably more.
MNMNOTE stores your notes locally in your browser, in open Markdown files you own — including every footnote definition you place. mnmnote.com
References
Footnotes
-
Choi, Palomaki, Lamm, Kwiatkowski, Das, Collins, "Decontextualization: Making Sentences Stand-Alone," TACL 9:447–461, 2021-04-26. Abstract. https://aclanthology.org/2021.tacl-1.27/ ↩ ↩2
-
LangChain source:
langchain_text_splitters/markdown.py@e2db4747 (taglangchain-text-splitters==1.1.3); LlamaIndex source:llama_index/core/node_parser/file/markdown.py@3aaab93a (tagv0.14.26).grep -n "footnote\|\[\^"over all relevant files returns zero hits in any footnote-parsing context. https://github.com/langchain-ai/langchain/blob/e2db474707c90248f74b1398ea6f13883605f7e7/libs/text-splitters/langchain_text_splitters/markdown.py · https://github.com/run-llama/llama_index/blob/3aaab93a2e823b9637ce3c6f0611e5e18a4a7a5b/llama-index-core/llama_index/core/node_parser/file/markdown.py ↩ ↩2 -
GitHub Docs, "Basic writing and formatting syntax — Footnotes." https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#footnotes ↩ ↩2 ↩3
-
John MacFarlane, Pandoc User's Guide, Extension
footnotes, pandoc 3.13 (2026-10-26). https://pandoc.org/MANUAL.html#extension-footnotes ↩ -
Own receipt, 2026-11-14.
python -I chunk.py note-a.md note-b.md note-c.md→receipt.txt,receipt-c.txt. Versions: langchain-text-splitters 1.1.3, langchain-core 1.8.0, llama-index-core 0.14.26, Python 3.14. Orphan metric: a marker occurrence[^x]whose definition's URL is absent from the same chunk. ↩ -
PyPI Stats,
langchain-text-splitters: approximately 41 million downloads/month (pypistats.org, accessed 2026-11-14). https://pypistats.org/api/packages/langchain-text-splitters/recent ↩ -
PyPI Stats,
llama-index-core: approximately 5.8 million downloads/month (pypistats.org, accessed 2026-11-14). https://pypistats.org/api/packages/llama-index-core/recent ↩ -
Own receipt, 2026-11-14.
python -I defaults.py …→receipt-defaults.txt.MarkdownTextSplitterinheritschunk_size=4000, chunk_overlap=200fromlangchain_text_splitters/base.pyl.64–65. LlamaIndexDEFAULT_CHUNK_SIZE=1024tokens (llama_index/core/constants.pyl.10). ↩ ↩2 -
John MacFarlane, Pandoc User's Guide, option
--reference-location, pandoc 3.13. https://pandoc.org/MANUAL.html#option--reference-location ↩ -
Own receipt, 2026-11-14. Notes re-run through same six configs after
pandoc -f markdown -t markdown-smart --reference-location=block --wrap=preserve. Files:*.fix.md. Heading-based splitters reached 0/9, 0/8, 0/24 on all three notes. ↩ -
Own receipt, 2026-11-14. Pandoc side-effect inventory from
note-b.block-links.md,obs.md,obs2.md. Pandoc--wrapmanual: "Withauto(the default), pandoc will attempt to wrap lines to the column width specified by--columns(default 72)." https://pandoc.org/MANUAL.html#option--wrap ↩ -
Own receipt, 2026-11-14.
inline_fn.pypre-pass on same three notes. Files:*.inline.md. Results: 1/250 orphaned (note A: 0/54, note B: 1/48, note C: 0/148). ↩ -
Chen, Wang, Chen, Yu, Ma, Zhao, Zhang, Yu, "Dense X Retrieval: What Retrieval Granularity Should We Use?," EMNLP 2024 pp. 15159–15177. "Propositions are defined as atomic expressions within text, each encapsulating a distinct factoid and presented in a concise, self-contained natural language format." https://aclanthology.org/2024.emnlp-main.845/ ↩