Skip to content

nrynss/markdown-table-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Markdown Table to YAML Converter

A Go application that scans markdown files in a directory structure and converts tables to YAML format while preserving column order. Designed specifically for processing Hugo documentation sets with files named *index.en.md.

Features

  • Recursively processes markdown files in directory structures
  • Preserves table column order in YAML output
  • Generates YAML files with well-formatted table data
  • Provides detailed logging with error tracking
  • Shows real-time progress with ETA
  • Handles multi-line content in table cells
  • Provides summary of files containing tables

Installation

go build -o bin/converter cmd/converter/main.go

Usage

./bin/converter -input /path/to/markdown/files -output /path/to/output/dir

Command Line Options

  • -input: Input directory containing markdown files (required)
  • -output: Output directory for YAML files (optional, defaults to ./output)
  • -log: Path to log file (optional, defaults to error.log)

Output Format

Markdown

| Option | Description |
| :-- | :-- |
| ascending | Ascending order (default) |
| descending | Descending order |

YAML

Table 1:
  - Option: ascending
    Description: Ascending order (default)
  - Option: descending
    Description: Descending order

Hugo Shortcode

The yamltable.html shortcode renders YAML tables in Hugo documentation.

Installation in Hugo Project

Copy yamltable.html to your Hugo project's shortcodes folder:

cp yamltable.html /path/to/hugo/layouts/shortcodes/

Usage in Hugo Project

Use the shortcode in your Hugo markdown files:

{{% yamltable %}}
- Option: ascending
  Description: Ascending order (default)
- Option: descending
  Description: Descending order
{{% /yamltable %}}

Special Values

The shortcode supports special placeholder values that render as icons:

Value Renders Description
-yes- ✓ (green) Feature fully supported
-no- ✗ (red) Feature not supported
-limited- ◐ (orange) Feature partially supported
-note- 📝 Note indicator
-warning- 🛑 Warning indicator
-tip- 🧭 Tip indicator

Error Logging

The application generates a detailed error.log file containing:

  • Processing summary
  • Memory statistics
  • Success/failure counts
  • Error breakdown by type
  • List of files containing tables

Project Structure

markdown-table-converter/
├── cmd/converter/
├── internal/
│   ├── parser/
│   ├── converter/
│   ├── logger/
│   ├── progress/
│   └── utils/
└── pkg/types/

Credits

Created by Narayan SS

Special thanks to:

  • Claude (Anthropic) : For extensive help with code structure, debugging, and implementation
  • Gemini (Google) : For additional assistance and suggestions

License

Copyright 2025 Narayan SS

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: Apache License

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors