
Featured image: Build a Product Documentation Website with Astro Starlight (1200 × 630 pixels).
WordPress SEO Publishing Details
Field | Recommended value |
SEO title | Astro Starlight Tutorial: Build a Product Documentation Website |
Meta description | Learn how to build a fast, searchable customer documentation website with Astro Starlight. Set up Markdown, navigation, SEO, search, CI/CD and AWS hosting. |
Focus keyword | Astro Starlight |
Secondary keywords | Astro Starlight tutorial; product documentation website; Astro documentation theme; customer help center; Markdown documentation; static documentation site |
URL slug | astro-starlight-product-documentation-guide |
Categories | Web Development; Documentation; DevOps |
Tags | Astro; Starlight; Markdown; MDX; Documentation; AWS; CloudFront; GitHub Actions; SEO |
Editorial note: Commands in this tutorial are based on the official documentation available at the time of preparation. They are documented examples, not commands independently executed in your environment. Validate package versions and AWS resource settings in a staging account before production use.
Table of Contents
1. Introduction
2. What is Astro Starlight?
3. When should you choose Starlight?
4. Plan the documentation information architecture
5. Install and run Starlight
6. Understand the project structure
7. Configure the site
8. Create customer documentation
9. Build navigation and content patterns
10. Search, SEO and accessibility
11. Branding and customization
12. Deploy to AWS S3 and CloudFront
13. CI/CD with GitHub Actions
14. Quality, security and maintenance
15. Practical hands-on exercise
16. Troubleshooting
17. Best practices
18. Frequently asked questions
19. Conclusion
Official references
1. Introduction
A product can be powerful and still feel difficult to use when customers cannot find clear answers. Good documentation reduces friction during onboarding, explains workflows, helps users recover from common errors, and gives support teams a reliable place to direct customers.
Astro Starlight is an open-source documentation framework built on Astro. It provides a ready-made documentation experience with navigation, search, internationalization, SEO foundations, code highlighting, accessible typography and theme support. It lets a team focus on the content and product experience instead of building a documentation interface from scratch.
This guide builds a public customer documentation site. The example uses a fictional product named Acme Desk and a deployment pattern using Git, GitHub Actions, Amazon S3 and CloudFront. Adapt names, regions, domains and AWS resources to your own environment.
2. What is Astro Starlight?
Starlight is an Astro integration and documentation theme. Pages are authored as Markdown, MDX or Markdoc files and organized in a content directory. Starlight generates a static site by default, which can be hosted on a static web host or delivered through a CDN.
Built-in capability | What it means for customer docs |
Navigation and sidebar | Group onboarding, feature guides, account help and troubleshooting. |
Full-text search | Customers can search indexed documentation pages. |
Markdown, MDX and Markdoc | Writers can author structured content; MDX also supports components. |
SEO foundations | Page titles, descriptions, canonical URL configuration and sitemap integrations can support discoverability. |
Internationalization | Organize localized documentation with locale-aware routes and fallback content. |
Code highlighting | Present commands and technical examples in readable code blocks. |
Theme support | Offer light/dark appearance and customize the visual identity. |
Astro integrations | Add analytics, integrations and custom UI where required. |
Starlight includes full-text search powered by Pagefind by default. The search index is generated during the build, so search does not require a separate hosted search service for a typical static documentation site.
3. When should you choose Starlight?
3.1 A strong fit
Your team is comfortable with Git and pull requests.
You want ownership of the content repository and generated site.
You need a fast public site with predictable hosting costs.
You want to customize navigation, layout, branding and components.
Your documentation is mostly guides, tutorials, FAQs, product workflows and reference pages.
3.2 When a managed knowledge base may be better
If non-technical support writers need a browser-based editor, approval workflows, article ownership dashboards and support-ticket integrations without using Git, compare managed platforms such as GitBook or Document360. Starlight is a framework: your team owns the editorial workflow, hosting and integrations.
Need | Suggested direction |
Developer-managed docs with full control | Astro Starlight |
Browser-first editing for support writers | GitBook or Document360 |
Interactive API reference and API try-it-out | Dedicated API documentation platform alongside Starlight |
Private, permission-controlled knowledge base | Evaluate a platform with authentication and access controls |
4. Plan the documentation information architecture
Start with customer tasks rather than your internal engineering team structure. Customers generally think in terms of what they are trying to accomplish: create an account, configure a feature, invite a teammate, connect an integration, understand a bill, or fix a problem.

Figure 1. A customer-task-oriented documentation information architecture.
4.1 Recommended top-level sections
Section | Example articles |
Getting started | Welcome; create an account; first login; initial setup; quick start |
Product overview | What the product does; key concepts; roles and permissions |
Features | Feature overview; configuration; workflows; limitations |
Tutorials | Complete a common task; real-world examples; guided walkthroughs |
Integrations | Connect supported services; authentication; sync behavior |
Account and settings | Profile; team members; security settings; notifications |
Billing and subscription | Plans; invoices; payment methods; cancellation |
Troubleshooting | Common errors; diagnostics; known limitations; recovery steps |
What’s new | Release notes; deprecations; migration notices |
Contact support | Support channels; what information to include; response expectations |
4.2 Article template
Use a repeatable structure so customers know what to expect.
Title that describes the task or question.
Short outcome statement: what the reader will achieve.
Prerequisites, permissions and required plan, if any.
Numbered steps using the exact labels shown in the product UI.
Expected result or verification step.
Troubleshooting notes and known limitations.
Related articles and a clear next step.
Review owner and last-reviewed date in the content process.
5. Install and run Starlight
Prerequisites: a supported Node.js release, npm (or another package manager), Git, and a code editor. Check the current Astro and Starlight requirements before selecting a Node.js version for a new project.
5.1 Create the project
BASH
npm create astro@latest -- --template starlight
The official Starlight quick start uses the Astro project creator with the Starlight template. Follow the prompts to name the project and choose a package manager.
5.2 Install dependencies and start the development server
BASH
cd my-docs npm install npm run dev
Open the local URL printed by the development server. Keep the process running while editing pages; Astro refreshes the preview as files change.
5.3 Build the production site
BASH
npm run build npm run preview
The production build is normally written to the dist/ directory. The preview command serves the built output locally so you can inspect the production result before deployment.
Verification: confirm the homepage loads, sidebar links work, search returns relevant results, images load, and the browser console has no unexpected errors. These checks are recommended validation steps; they have not been run against your own project.
6. Understand the project structure
TEXT
my-docs/ ├── public/ │ └── images/ ├── src/ │ ├── assets/ │ ├── content/ │ │ └── docs/ │ │ ├── index.mdx │ │ ├── getting-started/ │ │ ├── features/ │ │ ├── tutorials/ │ │ ├── account/ │ │ └── troubleshooting/ │ └── content.config.ts ├── astro.config.mjs ├── package.json └── tsconfig.json
Path | Purpose |
src/content/docs/ | Markdown, MDX and Markdoc documentation pages. |
public/ | Static files copied to the build output without content processing. |
src/assets/ | Assets imported and processed by Astro. |
astro.config.mjs | Astro and Starlight integration configuration. |
package.json | Scripts and package dependencies. |
dist/ | Generated production website; normally created by the build. |
7. Configure the site
7.1 Basic Astro configuration
JAVASCRIPT
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
export default defineConfig({
integrations: [
starlight({
title: 'Acme Desk Help Center',
description: 'Guides and answers for Acme Desk customers',
social: {
// Add your official social links when available.
},
sidebar: [
{
label: 'Getting started',
items: [
{ slug: 'getting-started/index' },
{ slug: 'getting-started/create-account' },
{ slug: 'getting-started/first-project' },
],
},
{
label: 'Use Acme Desk',
autogenerate: { directory: 'features' },
},
{
label: 'Troubleshooting',
autogenerate: { directory: 'troubleshooting' },
},
],
}),
],
});
This is an illustrative configuration. Keep only options supported by the Starlight version installed in your project. The sidebar can use explicit links, groups, slugs and autogenerated directory entries.
7.2 Site identity and URL
Choose a stable public URL such as docs.example.com. Configure the Astro site URL using your production origin so generated canonical URLs and sitemap output can use the correct domain. Ensure DNS and HTTPS are configured before announcing the documentation site.
JAVASCRIPT
export default defineConfig({
site: 'https://docs.example.com',
integrations: [
starlight({
title: 'Acme Desk Help Center',
description: 'Customer guides, tutorials and troubleshooting.',
}),
],
});
Do not publish staging URLs as canonical URLs. If the documentation lives under a path rather than a dedicated subdomain, configure the base path and hosting rewrite behavior consistently.
8. Create customer documentation
8.1 Create a Markdown page
MARKDOWN
--- title: Create your first workspace description: Set up a workspace and invite your team. --- A workspace is the shared area where your team organizes its work. ## Before you begin - You need an active Acme Desk account. - Your account must have permission to create workspaces. ## Create a workspace 1. Sign in to Acme Desk. 2. Open **Workspaces**. 3. Select **Create workspace**. 4. Enter a name and select **Create**. ## Verify the result The new workspace appears in your workspace list.
8.2 Use MDX when you need interactive components
MDX lets you combine Markdown with JSX components. Use it sparingly for reusable callouts, tabs, cards or other interface elements. Keep essential instructions readable even if a custom component fails to load.
MDX
---
title: Connect an integration
description: Connect a supported service to Acme Desk.
---
## Before you begin
Confirm that you have administrator access to both services.
{/* Example: use Starlight components where appropriate. */}
## Steps
1. Open **Settings**.
2. Select **Integrations**.
3. Choose the service you want to connect.
4. Follow the authorization prompts.
## Confirm the connection
Return to the integrations page and verify that the status is **Connected**.
8.3 Write for customer outcomes
Use the same terminology as the product interface.
Write one task per article where practical.
Use numbered steps for sequences and bullets for unordered requirements.
Explain what a successful result looks like.
Call out plan restrictions, role permissions and regional differences.
Avoid screenshots that contain real customer data, secrets or personal information.
9. Build navigation and content patterns
9.1 Sidebar design
Keep the primary navigation short and task-oriented. Avoid exposing every article at the same level. Use groups for broad topics and autogenerated entries for directories whose contents change frequently.
9.2 Page frontmatter
YAML
--- title: Reset your password description: Recover access if you cannot sign in. sidebar: order: 2 ---
Use frontmatter for page-specific metadata supported by Starlight. Validate exact frontmatter properties against the version-specific reference documentation.
9.3 Versioning strategy
For customer documentation, version content when product behavior differs materially between supported releases. Do not create versions merely because a deployment happened. State which product version or plan an instruction applies to, and publish migration guidance when steps change.
10. Search, SEO and accessibility
10.1 Search
Starlight includes Pagefind-powered full-text search by default. Search quality still depends on clear article titles, descriptive headings and consistent terminology. Test searches using the words customers actually use, including common abbreviations and error messages.
10.2 SEO checklist
Set a unique, descriptive title for every article.
Write a concise description that explains the page’s purpose.
Use meaningful headings that match customer questions.
Use descriptive internal links rather than ‘click here’.
Set the production site URL and validate canonical URLs.
Generate and submit a sitemap where appropriate.
Avoid duplicate articles with only minor wording changes.
Keep important customer help pages crawlable if they are intended for public search.
Use redirects when moving or renaming important URLs.
Add useful image alternative text; do not stuff keywords into alt text.
10.3 Accessibility
Use a logical heading hierarchy.
Ensure keyboard users can navigate menus, links and interactive components.
Provide text alternatives for meaningful images.
Do not communicate status using color alone.
Use descriptive link text and meaningful button labels.
Check contrast and test at mobile widths.
Prefer real text over screenshots of text.
SEO and accessibility are ongoing quality practices, not a one-time plugin setting. Review representative pages with browser tools and accessibility testing before launch.
11. Branding and customization
Starlight can be extended with Astro components, CSS and integrations. Start with the built-in theme and customize only what supports your product identity or improves task completion.
11.1 Custom CSS
CSS
/* src/styles/custom.css */
:root {
--sl-color-accent-low: #dbeafe;
--sl-color-accent: #2563eb;
--sl-color-accent-high: #1e3a8a;
}
/* Example: make article content easier to scan. */
.sl-markdown-content h2 {
margin-top: 2rem;
}
Import custom CSS using the supported customCss configuration for your installed Starlight version. Treat CSS selectors tied to internal theme markup as implementation details and re-test them after upgrades.
11.2 Images and screenshots
Capture the current production UI or a stable staging environment.
Use synthetic accounts and non-sensitive sample data.
Crop screenshots to the relevant control or workflow.
Add a caption when the screenshot needs context.
Provide alt text that explains the purpose of the image.
Compress large screenshots and avoid unnecessarily huge source images.
12. Deploy to AWS S3 and CloudFront
A Starlight site built as a static site can be hosted from object storage and delivered through a CDN. A common AWS pattern is private S3 origin access through CloudFront, HTTPS with an ACM certificate, and a DNS alias for docs.example.com. Astro’s AWS deployment guide also documents S3 and CloudFront deployment approaches.

Figure 2. Reference architecture for static documentation delivery on AWS.
12.1 Build locally
BASH
npm ci npm run build ls -la dist/
Confirm that the output directory contains the generated HTML, assets and search index before uploading.
12.2 Create AWS resources
12.2.1 Keep the S3 origin private
Use CloudFront Origin Access Control (OAC) with an S3 REST origin for a private bucket design. Block public access at the bucket level and grant CloudFront access through a narrowly scoped bucket policy. Avoid combining OAC with an S3 website endpoint, because website endpoints do not support OAC.
Create an S3 bucket for the static site output and a CloudFront distribution. For a production design, prefer a private S3 bucket accessed through CloudFront Origin Access Control (OAC), rather than making the bucket publicly readable. Configure the default root object, HTTPS redirect, custom error handling and cache policies deliberately.
The exact CloudFront origin and access settings depend on whether you use the S3 REST origin with OAC or the S3 website endpoint. OAC is designed for the S3 REST origin; do not mix the two configurations.
12.3 Upload the build output
BASH
aws s3 sync ./dist/ s3://YOUR_DOCS_BUCKET/ --delete
The –delete option removes objects in the destination that no longer exist in the local build output. Use it only when the bucket or prefix is dedicated to this documentation site and you understand the effect.
12.4 Invalidate cached objects
12.4.1 Choose cache behavior deliberately
Use long-lived caching for fingerprinted assets and shorter caching for HTML documents that change frequently. If you deploy content-hashed filenames, customers can keep cached assets safely while new HTML points to the new versions.
BASH
aws cloudfront create-invalidation \ --distribution-id YOUR_DISTRIBUTION_ID \ --paths '/*'
For a mature setup, prefer content-hashed assets and carefully designed cache headers. Invalidate only paths that need refreshing; broad invalidations can increase deployment cost and reduce cache efficiency.
12.5 DNS and TLS
Request or import an ACM certificate in the AWS Region required by CloudFront (typically us-east-1 for CloudFront viewer certificates).
Add the certificate and docs.example.com as an alternate domain name on the distribution.
Create the appropriate DNS alias or CNAME record to the CloudFront distribution.
Wait for distribution deployment and DNS propagation.
Test HTTPS, redirects, canonical URLs, 404 behavior and search.
13. CI/CD with GitHub Actions
A practical workflow builds and validates the documentation on pull requests, then deploys after changes are merged to the production branch. Prefer short-lived AWS credentials through GitHub Actions OIDC and an AWS IAM role instead of long-lived access keys where your environment supports it.

Figure 3. Documentation publishing workflow with quality gates.
13.1 Example GitHub Actions workflow
This is an illustrative workflow. Pin third-party actions to reviewed immutable commit SHAs in production, and configure the AWS role trust policy and permissions for your repository.
YAML
name: Build and deploy documentation
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Build documentation
run: npm run build
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: documentation-site
path: dist/
deploy:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
environment: production
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Build documentation
run: npm run build
- name: Configure AWS credentials using OIDC
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }}
aws-region: ${{ vars.AWS_REGION }}
- name: Sync static site to S3
run: aws s3 sync ./dist/ s3://${{ vars.DOCS_BUCKET }}/ --delete
- name: Invalidate CloudFront
run: |
aws cloudfront create-invalidation \
--distribution-id "${{ vars.CLOUDFRONT_DISTRIBUTION_ID }}" \
--paths '/*'
For stronger efficiency, build once and promote the same artifact to production rather than rebuilding in the deploy job. The sample repeats the build to keep the workflow self-contained and easy to follow; production teams should generally pass the artifact between jobs.
13.2 IAM permissions
Grant only the permissions needed to list the dedicated bucket, write and delete objects under the documentation prefix, and create invalidations for the target CloudFront distribution. Scope resources to exact ARNs. Avoid broad administrator policies.
Use GitHub environment protection rules for production deployments, require review where appropriate, and restrict the OIDC trust policy to the intended repository, branch or environment.
14. Quality, security and maintenance
14.1 Documentation quality gates
Check | Why it matters | Suggested method |
Production build | Detects invalid content or configuration | npm run build |
Broken links | Prevents dead ends | Link checker in CI and periodic crawl |
Search relevance | Helps customers find answers | Test real customer queries |
Mobile layout | Many customers read on phones | Responsive browser testing |
Accessibility | Supports a wider range of users | Keyboard and automated checks |
Content freshness | Prevents outdated instructions | Owner and review cadence |
Security review | Avoids accidental exposure | Secret scanning and screenshot review |
14.2 Security considerations
Never commit API keys, tokens, private certificates or customer credentials.
Do not publish private support notes or internal runbooks in a public docs repository.
Review screenshots for email addresses, tenant IDs, access tokens and personal information.
Treat MDX and custom components as executable project code; review changes before merging.
Keep dependencies updated and review security advisories.
Restrict deployment credentials and use OIDC where practical.
If you need private documentation, design authentication and authorization explicitly; a public static site is not a private knowledge base.
14.3 Content ownership and review
Assign an owner to each major documentation area. Review high-impact onboarding, billing, security and troubleshooting content whenever the product changes and on a scheduled cadence. Add a visible feedback mechanism and review low-rated or frequently searched pages.
15. Practical hands-on exercise
Build a small customer help center for a fictional task-management product. Complete the following exercise in a local Starlight project.
Exercise A: Create the first sections
Create a Getting Started directory with a welcome page and account setup page.
Create a Features directory with one feature overview and one task-based tutorial.
Create a Troubleshooting directory with at least two common problems.
Add meaningful page titles and descriptions.
Add sidebar navigation for the new sections.
Exercise B: Add a customer task article
MARKDOWN
--- title: Invite a teammate description: Add a teammate to your workspace. --- ## Before you begin You must have permission to manage workspace members. ## Steps 1. Open **Workspace settings**. 2. Select **Members**. 3. Choose **Invite member**. 4. Enter the teammate's work email address. 5. Select a role and send the invitation. ## Verify The teammate appears with a pending invitation status until they accept. ## Troubleshooting If the invitation option is unavailable, check your role and workspace plan.
Exercise C: Validate and publish
Run the local development server and inspect every new page.
Run a production build and resolve errors.
Test search with phrases from the article titles and body text.
Review heading order, link labels, image alt text and mobile layout.
Create a pull request and ask another person to review the content.
Deploy to a staging domain before promoting to production.
16. Troubleshooting
Symptom | Likely cause | What to check |
Project creation fails | Node/package manager mismatch or network issue | Check supported Node.js version, npm and registry connectivity. |
Page is missing | File is outside docs content directory or slug is wrong | Check src/content/docs and generated route. |
Sidebar item does not appear | Incorrect slug, directory or config | Compare sidebar entry with the page slug and config syntax. |
Search returns no result | Page not in generated index or stale build | Rebuild, deploy and inspect Pagefind output. |
Images are broken | Incorrect path or case mismatch | Check public path, asset import and case-sensitive filename. |
Custom CSS has no effect | CSS not imported or selector changed | Check Starlight customCss configuration and browser styles. |
AWS upload is denied | IAM role lacks scoped permissions | Check role trust, bucket ARN, prefix and CloudFront ARN. |
CloudFront shows old content | Cached HTML or asset path | Review cache headers and invalidate affected paths. |
404 after deployment | Wrong origin, base path or error behavior | Check distribution origin, default root object and generated routes. |
HTTPS certificate error | Certificate/domain mismatch or wrong region | Check certificate SANs, CloudFront attachment and DNS record. |
16.1 Debugging sequence
BASH
npm ci npm run build npm run preview # Inspect the generated files find dist -maxdepth 3 -type f | sort | head -100 # Inspect the S3 destination (after configuring AWS credentials) aws s3 ls s3://YOUR_DOCS_BUCKET/ --recursive | head -100
The commands above are diagnostic examples. Run them from the project root and replace placeholders with your actual resource names. The AWS CLI commands require a configured profile or role and sufficient permissions.
17. Best practices
Design navigation around customer jobs, not internal teams.
Keep one canonical article for each customer question and link to it from related pages.
Use short, stable URLs and redirect changed routes.
Write task-oriented titles such as ‘Invite a teammate’ rather than vague titles such as ‘Members’.
Show prerequisites and permission requirements before the steps.
Include a verification step so readers know when the task is complete.
Use screenshots only when they clarify a task; keep them current.
Review high-traffic and low-feedback pages first.
Keep release notes separate from evergreen how-to instructions.
Test every deployment in a staging environment before production.
Use pull requests for review, history and accountability.
Track unanswered searches and support-ticket themes to identify missing articles.
18. Frequently asked questions
Is Astro Starlight free?
Starlight is open-source software. You still pay for hosting, domain registration and any external services you choose to add.
Does Starlight include search?
Yes. Starlight includes full-text search powered by Pagefind, which is generated as part of the site build.
Can non-developers edit Starlight documentation?
They can edit Markdown through a Git-based web interface, but this is not the same as a full visual knowledge-base editor. A CMS can be added if browser-first editing is essential.
Can I use a custom domain?
Yes. Configure the production site URL, DNS, hosting and TLS certificate for your domain.
Can I host Starlight on AWS?
Yes. A static Starlight build can be deployed to S3 and served through CloudFront. Configure the bucket and distribution securely.
Can I make documentation multilingual?
Starlight has built-in internationalization support for locale routing and translated content.
Can I add videos and screenshots?
Yes. Add media assets to the project and reference them from your documentation. Optimize image size and provide useful alt text.
Can Starlight replace a customer support platform?
No. It provides documentation, not a complete ticketing or customer-support workflow. Link it to your support system.
Should I put private internal runbooks in the public docs site?
No. Keep public customer documentation separate from private operational documentation, and implement access controls for private material.
Is Starlight suitable for API documentation?
It can host API guides and reference content. For interactive API exploration, integrate a dedicated API reference tool where needed.
19. Conclusion
Astro Starlight is a compelling foundation for a public customer documentation website when your team values performance, content ownership, customization and a Git-based workflow. It provides the documentation essentials—navigation, search, content formats, internationalization and SEO foundations—without requiring you to build a documentation theme from scratch.
The most successful documentation site is not the one with the most plugins or the fanciest theme. It is the one that helps customers complete tasks quickly, understand product behavior and solve problems independently. Start with a focused information architecture, publish a small set of excellent articles, measure what customers search for, and improve the content continuously.
Official documentation and references
- Starlight home — https://starlight.astro.build/
- Starlight getting started — https://starlight.astro.build/getting-started/
- Starlight configuration reference — https://starlight.astro.build/reference/configuration/
- Starlight site search — https://starlight.astro.build/guides/site-search/
- Starlight internationalization — https://starlight.astro.build/guides/i18n/
- Astro AWS deployment guide — https://docs.astro.build/en/guides/deploy/aws/
- Mammoth WordPress Converter plugin — https://wordpress.org/plugins/mammoth-docx-converter/
- Mammoth.js documentation — https://github.com/mwilliamson/mammoth.js
- Mammoth embedded style map tool — https://mike.zwobble.org/projects/mammoth/embed-style-map/
Appendix A. Mammoth style map
This document uses a dedicated Word paragraph style named Code Block. The following Mammoth style map is embedded in the DOCX package at mammoth/style-map so Mammoth.js can map code paragraphs to HTML preformatted blocks during conversion.
MAMMOTH STYLE MAP
p[style-name='Code Block'] => pre:separator('\n')
p[style-name='Image Caption'] => p.image-caption
p[style-name='Callout'] => blockquote
Mammoth’s WordPress plugin supports embedded style maps and can also be configured through MAMMOTH_OPTIONS. Confirm the converter version and preview the imported HTML because Mammoth intentionally prioritizes semantic structure over visual fidelity. The plugin documentation describes a separate plugin/document transform for detecting monospace paragraphs and assigning the Code Block style; this document applies that style directly to code paragraphs.
Appendix B. WordPress import and validation checklist
Upload this DOCX through the Mammoth .docx Converter workflow.
Preview the converted content before inserting it into the post.
Confirm Heading 1–4 become semantic heading elements.
Confirm Code Block paragraphs become preformatted code blocks.
Confirm all embedded images are imported and captions appear in the correct positions.
Check image alt text in the WordPress media library.
Review tables on desktop and mobile; Mammoth preserves table structure but not necessarily Word table styling.
Verify all hyperlinks and external references.
Set the featured image in the WordPress post editor using the 1200 × 630 featured image included near the start of this document.
Enter the SEO title, meta description, focus keyword, categories, tags and slug in your SEO plugin.
Preview the published post and correct any theme-specific spacing or code styling.
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services — all in one place.
Explore Hospitals