11import { fileURLToPath , URL } from 'node:url'
2- import yaml from 'vite-plugin-yaml'
32import llmstxt from 'vitepress-plugin-llms'
43import { defineConfig } from 'vitepress'
54import { useSidebar } from 'vitepress-openapi'
@@ -536,19 +535,101 @@ export default defineConfig({
536535
537536 markdown : {
538537 config : ( md ) => {
538+ // Success callout
539539 md . use ( container , 'success' , {
540540 validate : ( params ) => {
541541 return params . trim ( ) . match ( / ^ s u c c e s s \s * ( .* ) $ / )
542542 } ,
543543 render : ( tokens , idx ) => {
544544 const m = tokens [ idx ] . info . trim ( ) . match ( / ^ s u c c e s s \s + ( .* ) $ / )
545545 if ( tokens [ idx ] . nesting === 1 ) {
546- // opening tag
547- return `<div class="custom-block success">${ m ? `<p class="custom-block-title">${ m [ 1 ] } </p>` : ''
548- } \n`
546+ return `<Callout type="success" title="${ m ? m [ 1 ] : '' } ">`
549547 } else {
550- // closing tag
551- return '</div>\n'
548+ return '</Callout>'
549+ }
550+ }
551+ } )
552+ // Tip callout
553+ md . use ( container , 'tip' , {
554+ validate : ( params ) => {
555+ return params . trim ( ) . match ( / ^ t i p \s * ( .* ) $ / )
556+ } ,
557+ render : ( tokens , idx ) => {
558+ const m = tokens [ idx ] . info . trim ( ) . match ( / ^ t i p \s + ( .* ) $ / )
559+ if ( tokens [ idx ] . nesting === 1 ) {
560+ return `<Callout type="tip" title="${ m ? m [ 1 ] : '' } ">`
561+ } else {
562+ return '</Callout>'
563+ }
564+ }
565+ } )
566+ // Warning callout
567+ md . use ( container , 'warning' , {
568+ validate : ( params ) => {
569+ return params . trim ( ) . match ( / ^ w a r n i n g \s * ( .* ) $ / )
570+ } ,
571+ render : ( tokens , idx ) => {
572+ const m = tokens [ idx ] . info . trim ( ) . match ( / ^ w a r n i n g \s + ( .* ) $ / )
573+ if ( tokens [ idx ] . nesting === 1 ) {
574+ return `<Callout type="warning" title="${ m ? m [ 1 ] : '' } ">`
575+ } else {
576+ return '</Callout>'
577+ }
578+ }
579+ } )
580+ // Danger callout
581+ md . use ( container , 'danger' , {
582+ validate : ( params ) => {
583+ return params . trim ( ) . match ( / ^ d a n g e r \s * ( .* ) $ / )
584+ } ,
585+ render : ( tokens , idx ) => {
586+ const m = tokens [ idx ] . info . trim ( ) . match ( / ^ d a n g e r \s + ( .* ) $ / )
587+ if ( tokens [ idx ] . nesting === 1 ) {
588+ return `<Callout type="danger" title="${ m ? m [ 1 ] : '' } ">`
589+ } else {
590+ return '</Callout>'
591+ }
592+ }
593+ } )
594+ // Info callout
595+ md . use ( container , 'info' , {
596+ validate : ( params ) => {
597+ return params . trim ( ) . match ( / ^ i n f o \s * ( .* ) $ / )
598+ } ,
599+ render : ( tokens , idx ) => {
600+ const m = tokens [ idx ] . info . trim ( ) . match ( / ^ i n f o \s + ( .* ) $ / )
601+ if ( tokens [ idx ] . nesting === 1 ) {
602+ return `<Callout type="info" title="${ m ? m [ 1 ] : '' } ">`
603+ } else {
604+ return '</Callout>'
605+ }
606+ }
607+ } )
608+ // Neutral callout
609+ md . use ( container , 'neutral' , {
610+ validate : ( params ) => {
611+ return params . trim ( ) . match ( / ^ n e u t r a l \s * ( .* ) $ / )
612+ } ,
613+ render : ( tokens , idx ) => {
614+ const m = tokens [ idx ] . info . trim ( ) . match ( / ^ n e u t r a l \s + ( .* ) $ / )
615+ if ( tokens [ idx ] . nesting === 1 ) {
616+ return `<Callout type="neutral" title="${ m ? m [ 1 ] : '' } ">`
617+ } else {
618+ return '</Callout>'
619+ }
620+ }
621+ } )
622+ // Details accordion
623+ md . use ( container , 'details' , {
624+ validate : ( params ) => {
625+ return params . trim ( ) . match ( / ^ d e t a i l s \s * ( .* ) $ / )
626+ } ,
627+ render : ( tokens , idx ) => {
628+ const m = tokens [ idx ] . info . trim ( ) . match ( / ^ d e t a i l s \s + ( .* ) $ / )
629+ if ( tokens [ idx ] . nesting === 1 ) {
630+ return `<details class="text-sm rounded-xl border px-6 py-0 last:[&>*]:mb-4 my-4 text-zinc-600 dark:text-zinc-300" style="background-color: var(--coollabs-bg-zinc-300-5); border-color: var(--coollabs-border-zinc-300-20);"><summary class="font-semibold mb-2 cursor-pointer select-none text-zinc-800 dark:text-zinc-100">${ m ? m [ 1 ] : '' } </summary>`
631+ } else {
632+ return '</details>'
552633 }
553634 }
554635 } )
@@ -572,8 +653,7 @@ export default defineConfig({
572653
573654 vite : {
574655 plugins : [
575- yaml as any ,
576- llmstxt ( {
656+ llmstxt ( {
577657 ignoreFiles : [
578658 '/docs/api-reference/api/**/*' ,
579659 '**/api-reference/api/**/*'
@@ -594,7 +674,6 @@ export default defineConfig({
594674 ] ,
595675 } ) ,
596676 ] ,
597- assetsInclude : [ '**/*.yml' ] ,
598677 define : {
599678 'import.meta.env.VITE_KORREKTLY_BASE_URL' : JSON . stringify ( env . KORREKTLY_BASE_URL || env . VITE_KORREKTLY_BASE_URL || '' ) ,
600679 'import.meta.env.VITE_KORREKTLY_API_TOKEN' : JSON . stringify ( env . KORREKTLY_API_TOKEN || env . VITE_KORREKTLY_API_TOKEN || '' ) ,
0 commit comments