GitHunt
NA

Zero-config executable MDX runner. Run your MDX files directly from the command line!

mdxe

Zero-config executable MDX runner. Run your MDX files directly from the command line!

Installation

# Global installation
npm install -g mdxe

# Or use with npx
npx mdxe

Usage

# Run a specific MDX file
mdxe path/to/file.mdx

# Run with npx
npx mdxe path/to/file.mdx

# Run in current directory
mdxe

Examples

Web Page

---
title:
description:
---

# Hello World!

This web page was rendered with [mdxe](https://mdxe.js.org)

Making MDX Files Executable

You can make your MDX files directly executable in two ways:

  1. Using the CLI command:

    mdxe make-executable file.mdx

    This will:

    • Add the shebang line (#!/usr/bin/env mdxe) if it's not present
    • Make the file executable (chmod +x)
  2. Manually:

    • Add the shebang line at the top of your MDX file:
      #!/usr/bin/env mdxe
      
      # My MDX File
      
      Content goes here...
    • Make the file executable:
      chmod +x file.mdx

After making a file executable, you can run it directly:

./file.mdx

When running without a file argument, mdxe will:

  1. Execute the single MDX file if only one exists in the current directory
  2. Present a selection menu if multiple MDX files are found
  3. Show a message if no MDX files are found

Features

  • Zero configuration required
  • Supports both global installation and npx usage
  • Interactive file selection when multiple MDX files are present
  • Automatic MDX compilation and execution
  • Beautiful CLI output with helpful error messages
  • Support for executable MDX files with shebang
  • CLI command to make files executable

License

MIT

Languages

TypeScript99.9%MDX0.1%

Contributors

Created December 12, 2024
Updated December 12, 2024
nathanclevenger/mdxe | GitHunt