Skip to content

Formatting

Markdoc comes with the ability to take a Markdoc abstract syntax tree (AST) and generate the source content. This is useful for generating Markdoc files from data, or prettifying documents.

Examples

Take for example you want to generate a Markdoc file from from some JSON:

// ./data.json
[
  [34.0522, -118.2437],
  [40.7128, -74.0060],
  [48.8566, 2.3522]
]

You can call Markdoc.format with an AST Node to generate the source content:

const Markdoc = require('@markdoc/markdoc')
const DATA = require('./data.json')

const list = new Markdoc.Ast.Node(
  'list',
  {ordered: false},
  DATA.map(point => new Markdoc.Ast.Node(
    'item',
    {},
    [
      new Markdoc.Ast.Node('inline', {}, [
        new Markdoc.Ast.Node(
          'text', 
          {content: point.join(', ')}, 
          []
        )
      ])
    ]
  ))
)

Markdoc.format(list)
- 34.0522, -118.2437
- 40.7128, -74.006
- 48.8566, 2.3522


title: Quick Links description: Explore key features and resources to get started quickly


Formatting

Get started with our platform by exploring the most popular resources and features below.


🚀 Most Popular


📚 Getting Started


🔌 API Integration


📖 Documentation Resources


🎯 Use Cases

Explore common use cases and implementation patterns:

  • Data Governance: Set up policies, roles, and permissions
  • Catalog Management: Organize and structure your data assets
  • Access Control: Manage user permissions and data access requests
  • API Integration: Connect external systems and automate workflows

💡 Need Help?

Information Circle

Can't find what you're looking for? Check out our community forum or browse the complete API documentation.

Checkmark Circle

New to the platform? Start with the Introduction to understand the core concepts, then explore the guides above based on your role.


🔗 External Resources


Last updated: December 2025

Loading editor...