How AI Helped Automate Content Workflows with Pandoc, Bash, and a Few Handy Utilities

Introduction

In July 2026, a detailed technical article on Habr caught the attention of developers and content creators alike. The piece, published by the YooMoney team, describes a practical approach to automating document conversion and content generation using AI, Pandoc, Bash scripting, and a handful of open-source utilities. The core idea is not about replacing human writers, but about streamlining repetitive tasks—like converting Markdown to PDF, generating consistent metadata, or batch-processing hundreds of files. This article summarizes that real-world case, offering a step-by-step guide that you can adapt for your own projects.

The Problem: Manual Content Conversion at Scale

The authors at YooMoney faced a common challenge: their team produced technical documentation and internal reports in Markdown, but needed to distribute them in multiple formats—PDF, HTML, DOCX, and even EPUB. Manually converting each file was error-prone and time-consuming, especially when dealing with dozens of documents that required consistent styling, headers, and footers. The team needed a solution that could:
- Convert Markdown to multiple output formats automatically.
- Apply custom templates and styles without manual intervention.
- Integrate with AI to generate summaries or metadata for each document.

The answer came in the form of a Bash script that orchestrated Pandoc, a few command-line utilities, and an AI model API.

The Solution: A Bash-Powered Pipeline

The developers built a pipeline that starts with a Markdown file. A Bash script triggers Pandoc with specific templates and options, then optionally calls an AI API (like OpenAI or a local model) to generate a short abstract or extract keywords. The final output includes not only the converted document but also a metadata file in YAML or JSON format.

Key Components

Component Role Example Tool
Markdown source Input format Any .md file
Pandoc Universal document converter Pandoc 3.x
Bash script Orchestrator and glue code GNU Bash 5.x
AI API Content summarization/metadata OpenAI API or local LLM
Utility tools Text processing, validation sed, awk, jq, yq

Step-by-Step Workflow

  1. Prepare the Markdown file: Write your content in standard Markdown. Include a YAML front matter with title, author, and date.
  2. Run the Bash script: The script reads the front matter, extracts metadata, and passes the file to Pandoc.
  3. Convert with Pandoc: Pandoc uses a custom template (e.g., template.tex for PDF) to apply consistent styling.
  4. AI enrichment: Optionally, the script sends the document body to an AI model, requesting a 2-3 sentence summary. The result is appended to the front matter.
  5. Output generation: The script produces the final document in the desired format(s).

Here’s a simplified version of the script (as described in the original article):

#!/bin/bash
# Convert Markdown to PDF with AI-generated summary
INPUT="$1"
OUTPUT="${INPUT%.md}.pdf"
TITLE=$(head -1 "$INPUT" | sed 's/^# //')

# Generate AI summary (requires API key)
SUMMARY=$(curl -s https://api.openai.com/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"model\": \"gpt-4o\", \"messages\": [{\"role\": \"user\", \"content\": \"Summarize this in 2 sentences: $(cat $INPUT)\"}]}" | jq -r '.choices[0].message.content')

# Convert with Pandoc
pandoc "$INPUT" -o "$OUTPUT" --metadata title="$TITLE" --metadata summary="$SUMMARY" --template=template.tex

Real-World Results

The YooMoney team reported that this pipeline reduced document conversion time by approximately 80%. Before automation, a developer spent 15-20 minutes per document for conversion and formatting. After implementation, the same task took under 2 minutes, with the AI summary generation adding only a few seconds. The script also eliminated human errors like inconsistent headers or missing metadata.

Practical Tips for Implementation

  • Start small: Automate conversion for one format (e.g., Markdown to PDF) before expanding to others.
  • Use templates: Pandoc supports LaTeX, HTML, and Word templates. Invest time in creating a reusable template for your brand.
  • Leverage AI sparingly: AI is great for summaries or metadata extraction, but avoid over-reliance—it can introduce inaccuracies if not carefully prompted.
  • Validate outputs: Use utilities like diff or pdftotext to compare converted files against expected outputs.
  • Integrate with CI/CD: Hook the script into a Git pipeline so that every push to a documentation repo triggers automatic conversion.

Conclusion

The article from YooMoney demonstrates that you don’t need a complex enterprise system to automate content workflows. With Pandoc, Bash, and a little help from AI, even a small team can achieve significant efficiency gains. The approach is modular—you can replace Pandoc with another converter, swap the AI API, or add new utilities as needed. For developers and content managers looking to save time and reduce errors, this pipeline offers a practical, low-cost starting point. The full details are available in the original post on Habr.

Source

← All posts

Comments