Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>DitaCraftNew to Visual Studio Code? Get it now.
DitaCraft

DitaCraft

Jeremy Jeanne

|
11 installs
| (0) | Free
Best way to edit and publish your DITA files - Complete DITA editing and publishing solution for VS Code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

DitaCraft

The best way to edit and publish your DITA files

VS Code License

DitaCraft is a comprehensive Visual Studio Code extension for editing and publishing DITA (Darwin Information Typing Architecture) content. It provides syntax highlighting, validation, and seamless integration with DITA-OT for multi-format publishing.

Features

📝 DITA Editing

  • Syntax highlighting for .dita, .ditamap, and .bookmap files
  • Intelligent code snippets and auto-completion
  • Real-time validation with inline error highlighting
  • Support for all DITA topic types (concept, task, reference, topic)

🚀 One-Click Publishing

  • Publish to multiple formats: HTML5, PDF, EPUB, and more
  • Direct integration with DITA Open Toolkit (DITA-OT)
  • Real-time progress tracking with visual indicators
  • Smart caching for faster preview generation

👁️ Live Preview

  • Side-by-side HTML5 preview
  • Auto-refresh on save
  • Navigate directly from source to preview

🎯 Quick File Creation

  • Create DITA topics from templates (concept, task, reference)
  • Generate DITA maps and bookmaps with proper structure
  • Pre-filled DOCTYPE declarations and valid XML structure

⚙️ Flexible Configuration

  • Configure DITA-OT installation path
  • Customize output formats and directories
  • Add custom DITA-OT arguments and filters
  • Choose validation engine (xmllint or built-in)

Installation

From VS Code Marketplace

  1. Open VS Code
  2. Press Ctrl+P / Cmd+P
  3. Type ext install ditacraft
  4. Press Enter

From VSIX

  1. Download the latest .vsix file from Releases
  2. Open VS Code
  3. Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
  4. Click ... menu → "Install from VSIX..."
  5. Select the downloaded file

Local Installation for Development

If you want to install the plugin locally from source code for development or testing:

Step 1: Prerequisites

Ensure you have the following installed:

  • Node.js 18.x or 20.x (Download)
  • npm (comes with Node.js)
  • VS Code 1.80 or higher
  • Git (optional, for cloning)

Step 2: Get the Source Code

# Clone the repository (or download ZIP from GitHub)
git clone https://github.com/jyjeanne/ditacraft.git
cd ditacraft

# OR if you downloaded as ZIP:
# Extract the ZIP file and navigate to the extracted folder
cd DitaCraft

Step 3: Install Dependencies

npm install

This will install all required npm packages (~429 packages).

Step 4: Compile TypeScript

npm run compile

This compiles the TypeScript source code to JavaScript in the out/ directory.

Step 5: Package the Extension

npm run package

This creates a .vsix file in the project root (e.g., ditacraft-0.1.0.vsix).

Note: If you don't have vsce installed, install it first:

npm install -g @vscode/vsce

Step 6: Install in VS Code

Option A: Install from VSIX

  1. Open VS Code
  2. Press Ctrl+Shift+X (or Cmd+Shift+X on macOS) to open Extensions
  3. Click the ... menu at the top right
  4. Select "Install from VSIX..."
  5. Navigate to your project folder
  6. Select the ditacraft-0.1.0.vsix file
  7. Click "Install"
  8. Reload VS Code when prompted

Option B: Run in Development Mode (Recommended for testing)

  1. Open the ditacraft folder in VS Code
  2. Press F5 (or Run → Start Debugging)
  3. A new VS Code window opens with the extension loaded
  4. Test the extension in this window
  5. Make changes to code, save, and press Ctrl+R in the Extension Host window to reload

Step 7: Verify Installation

  1. Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
  2. Type "DITA" - you should see all DitaCraft commands
  3. Try creating a new topic: "DITA: Create New Topic"

Step 8: Configure DITA-OT (Optional, for publishing)

  1. Download DITA-OT from https://www.dita-ot.org/download
  2. Extract to a location (e.g., C:\DITA-OT-4.2.1)
  3. In VS Code, run "DITA: Configure DITA-OT Path"
  4. Select your DITA-OT installation directory

Troubleshooting Local Installation

Issue: npm install fails

Solution:

  • Check Node.js version: node --version (should be 18.x or 20.x)
  • Clear npm cache: npm cache clean --force
  • Delete node_modules and package-lock.json, then run npm install again

Issue: Compilation errors

Solution:

  • Ensure TypeScript is installed: npm install -g typescript
  • Check for syntax errors in .ts files
  • Run npm run lint to check for code issues

Issue: Extension not appearing in VS Code

Solution:

  • Verify the .vsix file was created successfully
  • Check VS Code version is 1.80 or higher
  • Try uninstalling any existing version first
  • Restart VS Code completely

Issue: "Cannot find module" errors

Solution:

  • Run npm install again
  • Check that node_modules directory exists
  • Verify package.json has all dependencies

Development Workflow

For active development on the extension:

# Terminal 1: Watch mode (auto-compile on changes)
npm run watch

# Terminal 2: Run extension in debug mode
# Press F5 in VS Code (or Run → Start Debugging)

Making Changes:

  1. Edit TypeScript files in src/
  2. Watch mode auto-compiles to out/
  3. In Extension Host window, press Ctrl+R (or Cmd+R) to reload
  4. Test your changes

Running Tests:

npm test

Linting Code:

npm run lint

Prerequisites

Required

  • VS Code 1.80 or higher
  • Node.js 18.x or 20.x (for development)

For Publishing

  • DITA-OT 4.2.1 or higher (Download)

For Advanced Validation (Optional)

  • xmllint (libxml2) for strict XML validation

Quick Start

1. Install DITA-OT

Download and install DITA-OT from https://www.dita-ot.org/download

2. Configure DitaCraft

  1. Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
  2. Type "DITA: Configure DITA-OT Path"
  3. Select your DITA-OT installation directory

3. Create Your First DITA File

  1. Open Command Palette
  2. Type "DITA: Create New Topic"
  3. Select topic type (concept, task, reference)
  4. Enter file name

4. Publish

  1. Open your .dita, .ditamap, or .bookmap file
  2. Press Ctrl+Shift+B / Cmd+Shift+B
  3. Select output format (HTML5, PDF, etc.)
  4. View published content

Commands

All commands are accessible via Command Palette (Ctrl+Shift+P / Cmd+Shift+P):

Command Shortcut Description
DITA: Validate Current File Ctrl+Shift+V Validate DITA syntax and structure
DITA: Publish (Select Format) Ctrl+Shift+B Publish with format selection
DITA: Publish to HTML5 - Quick publish to HTML5
DITA: Preview HTML5 Ctrl+Shift+P Show live HTML5 preview
DITA: Create New Topic - Create new DITA topic
DITA: Create New Map - Create new DITA map
DITA: Create New Bookmap - Create new bookmap
DITA: Configure DITA-OT Path - Set DITA-OT installation path

Configuration

Basic Settings

{
    "ditacraft.ditaOtPath": "C:\\DITA-OT-4.2.1",
    "ditacraft.defaultTranstype": "html5",
    "ditacraft.outputDirectory": "${workspaceFolder}/out"
}

All Settings

Setting Type Default Description
ditacraft.ditaOtPath string "" DITA-OT installation path
ditacraft.defaultTranstype string "html5" Default output format
ditacraft.outputDirectory string "${workspaceFolder}/out" Output directory
ditacraft.autoValidate boolean true Auto-validate on save
ditacraft.previewAutoRefresh boolean true Auto-refresh preview
ditacraft.showProgressNotifications boolean true Show progress notifications
ditacraft.validationEngine string "xmllint" Validation engine
ditacraft.ditaOtArgs array [] Custom DITA-OT arguments
ditacraft.enableSnippets boolean true Enable code snippets

📖 Full Configuration Guide

Supported Output Formats

DitaCraft supports all DITA-OT transtypes:

  • HTML5 - Modern responsive HTML
  • PDF - PDF via Apache FOP
  • XHTML - XHTML output
  • EPUB - EPUB3 e-books
  • HTML Help - Windows CHM files
  • Markdown - Markdown conversion

Additional formats available through DITA-OT plugins.

Workflows

Publishing a Book

  1. Create bookmap: DITA: Create New Bookmap
  2. Create chapters: DITA: Create New Topic (multiple times)
  3. Edit bookmap to reference chapters
  4. Validate: Ctrl+Shift+V
  5. Publish: Ctrl+Shift+B → Select format
  6. Open output folder

Previewing Changes

  1. Open .dita file
  2. Make edits
  3. Press Ctrl+Shift+P to preview
  4. Preview auto-refreshes on save
  5. Toggle between source and preview

Using Filters (DITAVAL)

{
    "ditacraft.ditaOtArgs": [
        "--filter=filters/product-a.ditaval"
    ]
}

Development

Building from Source

# Clone repository
git clone https://github.com/jyjeanne/ditacraft.git
cd ditacraft

# Install dependencies
npm install

# Compile TypeScript
npm run compile

# Run tests
npm test

# Package extension
npm run package

Project Structure

ditacraft/
├── src/
│   ├── extension.ts           # Entry point
│   ├── commands/              # Command handlers
│   │   ├── validateCommand.ts
│   │   ├── publishCommand.ts
│   │   ├── previewCommand.ts
│   │   └── fileCreationCommands.ts
│   ├── utils/
│   │   └── ditaOtWrapper.ts   # DITA-OT integration
│   └── preview/
│       └── previewPanel.ts    # WebView preview
├── syntaxes/
│   └── dita.tmLanguage.json   # Syntax highlighting
├── snippets/
│   └── dita.json              # Code snippets
├── package.json               # Extension manifest
└── README.md

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Troubleshooting

DITA-OT Not Found

Problem: Extension shows "DITA-OT not found"

Solution:

  1. Verify DITA-OT is installed
  2. Run "DITA: Configure DITA-OT Path" command
  3. Select DITA-OT installation directory
  4. Verify with "DITA: Validate Current File"

Validation Errors

Problem: Validation shows unexpected errors

Solution:

  1. Check XML syntax (closing tags, quotes, etc.)
  2. Verify DOCTYPE declaration
  3. Try switching validation engine: "ditacraft.validationEngine": "built-in"

Publishing Fails

Problem: Publishing fails with error

Solution:

  1. Check DITA-OT logs in Output panel
  2. Verify output directory is writable
  3. Check for syntax errors in DITA file
  4. Try publishing with --verbose flag:
    "ditacraft.ditaOtArgs": ["--verbose"]
    

Preview Not Showing

Problem: Preview panel is blank or shows error

Solution:

  1. Verify HTML5 output was generated
  2. Check output directory exists
  3. Look for JavaScript errors in Developer Tools
  4. Try republishing: Ctrl+Shift+B → HTML5

📖 Full Troubleshooting Guide

Documentation

  • Configuration Guide - Complete settings documentation
  • Commands and Shortcuts - All commands and keybindings
  • DITA-OT Integration - DITA-OT integration details
  • Contributing Guide - Development and contribution guidelines

Resources

DITA Resources

  • DITA-OT Documentation
  • OASIS DITA Specification
  • DITA Style Guide

VS Code Resources

  • VS Code Extension API
  • VS Code Publishing

Recent Updates

Version 0.1.0 Fixes

  • ✅ Fixed preview and publishing with paths containing spaces - File paths with spaces (e.g., "Learn Rust/project") now work correctly
  • ✅ Fixed DITA validation - Title element is now correctly validated as required (error, not warning) per DTD spec
  • ✅ Enhanced DTD validation - Added proper DTD validation support with xmllint
  • ✅ Improved error messages - Better, more descriptive validation and publishing error messages
  • ✅ Fixed file path validation - Added comprehensive checks to ensure files (not directories) are being processed
  • ✅ Added verbose logging - Detailed console logging for easier debugging

Changelog

See CHANGELOG.md for release history.

License

This project is licensed under the MIT License - see LICENSE file for details.

Support

  • 🐛 Bug Reports: GitHub Issues
  • 💡 Feature Requests: GitHub Issues
  • 💬 Discussions: GitHub Discussions
  • 📧 Email: jyjeanne@gmail.com

Acknowledgments

  • DITA Open Toolkit team for the excellent DITA-OT
  • OASIS DITA Technical Committee
  • VS Code extension development community
  • All contributors and users

Made with ❤️ for technical writers and documentation teams

⭐ Star this project on GitHub

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft