Plainmark guide

How to prepare Markdown for RAG and AI knowledge bases.

Clean converted source material, preserve its provenance, and check its structure before retrieval, chunking, or indexing.

A research team organizing source documents for a knowledge base

The short answer

RAG-ready Markdown is not merely extracted text. It is readable source material with a clear heading hierarchy, intact lists and tables, useful links, limited duplication, and enough provenance to trace each claim back to the original document.

Prepare first, chunk secondClean and verify the document before a retrieval system splits it. Early extraction errors become harder to find after the text is divided and indexed.

What does “ready for RAG” mean?

Retrieval-augmented generation combines a language model with information retrieved from an external collection. The original RAG paper by Lewis and colleagues describes this as combining parametric memory with non-parametric memory accessed by a retriever. Your Markdown is part of that external source layer, so its structure and traceability matter.

A prepared document should help a later system answer three questions: what does this passage say, where does it belong, and where did it come from? Markdown helps express headings, paragraphs, lists, links, and images in readable plain text; the CommonMark specification documents those core structures.

  • Readable: paragraphs are complete and not broken at every visual line.
  • Structured: headings show the document hierarchy.
  • Traceable: the source URL or file name and relevant publication details remain attached.
  • Focused: navigation, repeated footers, and unrelated calls to action are removed.
  • Reviewable: important tables, lists, links, and images have been checked against the source.

Prepare source material in five steps

1. Convert the source into editable Markdown

Use the PDF to Markdown tool for a text-layer PDF or Web to Markdown for one public webpage. Conversion creates a working copy; it does not prove that the content is complete.

2. Compare the result with the source

Keep the source in view while checking the title, section order, paragraphs, lists, tables, links, and meaningful images. A clean-looking result can still contain a wrong reading order or missing context.

A real Plainmark webpage conversion with the visual source reference beside editable Markdown
Real Plainmark output: the visual source remains beside the editable Markdown so structure and wording can be checked before reuse.

3. Remove extraction noise and repetition

Delete cookie notices, navigation labels, repeated mobile menus, duplicated calls to action, empty image syntax, and footer text that appears on every page. Do not remove qualifiers, warnings, or citations simply because they look secondary.

4. Preserve provenance

Add the original URL or file name, document title, publisher or author when available, and the date accessed or published. Keep this information in a predictable block so it can travel with the text.

---
title: Quarterly infrastructure review
source: https://example.com/reports/infrastructure
publisher: Example Research
published: 2026-08-20
accessed: 2026-08-24
---

# Quarterly infrastructure review

5. Validate the document before indexing

Read it from top to bottom, open important links, compare every table row, and confirm that each heading introduces the content below it. Only then pass the document to a separate chunking and indexing process.

What should stay, and what should be removed?

Keep or repairRemove or rewrite
Document title and logical headingsDecorative headings with no content
Complete paragraphs and quotationsHard line breaks copied from page layout
Lists, tables, and code with meaningBroken rows or isolated table fragments
Source links, authors, and datesTracking parameters and empty links
Warnings, limitations, and definitionsRepeated navigation and promotional text
Useful image descriptionsDecorative icons and empty image syntax

The goal is not to make every document shorter. It is to keep evidence and meaning while removing material that makes retrieval less precise.

Use document structure to guide chunking

Chunking belongs to the retrieval pipeline, not the Markdown conversion step. Still, better headings and complete paragraphs give a later chunker safer boundaries. The Microsoft Learn guide to document chunking explains that chunk size depends on the model and workflow, and describes structure-aware approaches alongside fixed-size methods.

  • Keep a heading with the paragraphs it introduces.
  • Avoid splitting a table in the middle of a row.
  • Keep a quotation with its attribution.
  • Carry document-level source metadata into every stored chunk.
  • Test retrieval with real questions rather than assuming one chunk size fits every source.
Do not optimize for token count aloneA perfectly sized chunk can still be useless if it has lost its heading, source, qualifier, or table labels.

Pre-indexing review checklist

CheckPass condition
CompletenessEvery relevant section appears in the Markdown.
Reading orderThe document makes sense from top to bottom.
HierarchyOne H1 is followed by consistent H2 and H3 sections.
ProvenanceThe original file or URL and publication details are recorded.
Tables and listsLabels, rows, and nested items remain associated correctly.
NoiseRepeated navigation, footers, and interface labels are removed.
Rights and privacyYou are allowed to process and store the source material.

Frequently asked questions

Does Plainmark create embeddings or a vector database?

No. Plainmark converts and helps you review source material. Embedding, chunking, retrieval, access control, and indexing belong to the RAG system you choose.

Is Markdown required for RAG?

No. Retrieval systems can use HTML, JSON, plain text, database records, and other formats. Markdown is useful because humans can read and repair it while it still carries basic document structure.

Should every converted image stay in the knowledge base?

No. Keep images that add evidence or context, and add useful descriptions where appropriate. Remove decorative images and empty references. A text-only retrieval pipeline cannot infer information that exists only inside an image.

Can I index private documents?

Only when you have permission and the storage, access controls, retention rules, and model providers match your privacy requirements. Review those systems separately before uploading confidential material.

Start with Markdown you can inspect.

Convert the source, compare it with the original, and repair the structure before it enters your AI workflow.

Convert a PDF