Markdown to Protocol Buffers Converter

Transform Markdown tables into Protocol Buffers format

Markdown Input

Protocol Buffers Output

About Markdown to Protocol Buffers Converter

Convert Markdown tables to Protocol Buffers (protobuf) schema and sample data. Perfect for API development, microservices, and data serialization.

Key Features

  • Schema Generation: Automatic .proto file creation with proto3 syntax
  • Type Inference: Detects string, bool, int32, int64, and double types
  • Field Sanitization: Converts column names to valid protobuf identifiers
  • Sample Data: Generates textproto format sample data
  • Field Comments: Preserves original column names as comments
  • Download: Save as .proto file

How to Use

  1. Input Markdown Table: Paste your Markdown table or upload a .md file
  2. Review Schema: The proto3 schema is generated automatically
  3. Check Sample Data: Review the textproto format sample data
  4. Copy or Download: Use the schema in your protobuf project
  5. Compile: Use protoc to compile the schema

Type Detection

  • bool: Values are "true" or "false" (case-insensitive)
  • int32: Integer values fitting in 32-bit signed range (-2,147,483,648 to 2,147,483,647)
  • int64: Integer values outside int32 range
  • double: Floating-point numbers with decimals or scientific notation
  • string: All other values (default type)

Example Conversion

Markdown Input:

| Name | Age | City | Department |
|------|-----|------|------------|
| John Doe | 28 | New York | Engineering |
| Jane Smith | 34 | London | Marketing |

Protocol Buffers Output:

syntax = "proto3";

package markdown_converter;

message MarkdownRecord {
  string name = 1; // Name
  int32 age = 2; // Age
  string city = 3; // City
  string department = 4; // Department
}

message MarkdownData {
  repeated MarkdownRecord records = 1;
}

// Rows processed: 2

// Sample data in textproto format
MarkdownData {
  records {
    name: "John Doe"
    age: 28
    city: "New York"
    department: "Engineering"
  }
  records {
    name: "Jane Smith"
    age: 34
    city: "London"
    department: "Marketing"
  }
}

Common Use Cases

  • API Development: Define message schemas for gRPC services
  • Microservices: Create data contracts between services
  • Data Serialization: Efficient binary data format
  • Cross-Platform: Language-agnostic data exchange
  • Documentation: Generate schemas from documentation tables
  • Testing: Create test data in textproto format
  • Configuration: Define config file schemas

Protocol Buffers Features

  • Proto3 Syntax: Latest protobuf syntax version
  • Package Name: "markdown_converter" namespace
  • Message Types: MarkdownRecord (single row) and MarkdownData (collection)
  • Field Numbers: Sequential numbering starting from 1
  • Repeated Fields: Array of records in MarkdownData
  • Comments: Original column names preserved

Field Name Sanitization

Column names are automatically sanitized for protobuf:

  • Spaces and special characters → underscores
  • Accented characters → normalized to ASCII
  • Names starting with numbers → prefixed with "field_"
  • Converted to lowercase for consistency
  • Duplicate names → numbered suffixes (_2, _3, etc.)
  • Example: "First Name" → "first_name"

Using the Generated Schema

Compile with protoc:

# Generate Python code
protoc --python_out=. output.proto

# Generate Go code
protoc --go_out=. output.proto

# Generate Java code
protoc --java_out=. output.proto

# Generate C++ code
protoc --cpp_out=. output.proto

Example Python Usage:

import output_pb2

# Create a record
record = output_pb2.MarkdownRecord()
record.name = "John Doe"
record.age = 28
record.city = "New York"
record.department = "Engineering"

# Serialize to binary
binary_data = record.SerializeToString()

# Deserialize from binary
new_record = output_pb2.MarkdownRecord()
new_record.ParseFromString(binary_data)

Advantages of Protocol Buffers

  • Compact: Binary format is smaller than JSON or XML
  • Fast: Faster serialization/deserialization than text formats
  • Typed: Strong typing prevents errors
  • Versioning: Schema evolution with backward compatibility
  • Cross-Language: Works with 20+ programming languages
  • Code Generation: Automatic client/server code generation

Tips for Best Results

  • Use descriptive column names (they become field names)
  • Ensure consistent data types within columns
  • Avoid special characters in column names
  • Use lowercase_with_underscores naming convention
  • Keep field names short but meaningful
  • Review generated types and adjust if needed
  • Test with protoc compiler before deployment

Supported Languages

Protocol Buffers supports code generation for:

  • C++, C#, Java, Kotlin, Python, Go, Ruby, PHP
  • Objective-C, Swift, Dart, JavaScript, TypeScript
  • And many more through community plugins

Privacy & Security

All conversions happen locally in your browser. Your Markdown data is never uploaded to any server, ensuring complete privacy and security.