Skip to content

nuxt-alap ​

Nuxt 3 integration for Alap — client plugin factory, Vue component re-exports, and optional Nuxt Content markdown support.

Install ​

Available in the Alap monorepo at integrations/nuxt-alap/.

Install from the monorepo
bash
git clone https://github.com/DanielSmith/alap.git
cd alap
pnpm install
pnpm build
cd integrations/nuxt-alap
pnpm build

Then add it to your project as a local dependency in your package.json:

json
"nuxt-alap": "file:../path-to-alap/integrations/nuxt-alap"

Quick start ​

1. Create the client plugin ​

ts
// plugins/alap.client.ts
import { createAlapPlugin } from 'nuxt-alap';
import config from '~/alap-config';

export default createAlapPlugin({ config });

The .client.ts suffix ensures it only runs in the browser (no SSR HTMLElement errors).

2. Use in pages ​

vue
<!-- pages/index.vue -->
<template>
  <AlapProvider :config="config">
    <p>Visit <AlapLink query=".coffee">cafes</AlapLink>.</p>
  </AlapProvider>
</template>

<script setup>
import { AlapProvider, AlapLink } from 'nuxt-alap';
import config from '~/alap-config';
</script>

What it provides ​

createAlapPlugin(options) ​

Factory for a Nuxt client plugin. Registers the Alap config and web component.

OptionTypeDefaultDescription
configAlapConfigrequiredLink configuration
configNamestring—Named config for multi-config setups
webComponentbooleantrueAlso register <alap-link> for Nuxt Content

Component re-exports ​

Convenience imports from alap/vue:

ExportWhat
AlapProviderVue provider component
AlapLinkMenu trigger component
useAlap()Composable for programmatic access

withAlap() config wrapper ​

For Nuxt Content markdown support:

ts
// nuxt.config.ts
import { withAlap } from 'nuxt-alap';

export default defineNuxtConfig(withAlap({
  modules: ['@nuxt/content'],
}, { markdown: true }));

Adds remark-alap to the Nuxt Content markdown pipeline so [text](alap:query) in .md files becomes <alap-link>.

Web component in Nuxt Content ​

When webComponent: true (default), the client plugin registers <alap-link>. This means Nuxt Content markdown files can use the alap: link syntax, and the web components self-initialize client-side.

Security ​

  • Client-only execution — createAlapPlugin checks for window and uses dynamic import('alap') to avoid HTMLElement during SSR
  • No webpack plugins — pure config manipulation, no build hooks
  • No eval or code generation — withAlap() only merges config objects
  • Same security guarantees as alap/vue — URL sanitization, config validation, parser limits

See also ​

License ​

Apache-2.0