Skip to content

Can you provide an expo example project with Web Platform Support #76

Open
@rdmclin2

Description

@rdmclin2

The readme file shows an approach with web platform support :

import { createHighlighterCore } from '@shikijs/core'
import { createOnigurumaEngine } from '@shikijs/engine-oniguruma'
import { createNativeEngine, isNativeEngineAvailable } from 'react-native-shiki-engine'

function createAdaptiveEngine() {
  // Use native engine for native platforms
  if (isNativeEngineAvailable()) {
    return createNativeEngine()
  }
  // Fallback to Shiki's WASM engine for web platforms
  return createOnigurumaEngine(import('shiki/wasm'))
}

const highlighter = createHighlighterCore({
  themes: ['nord'],
  langs: ['javascript'],
  engine: createAdaptiveEngine(),
})

can you provide an example expo project to show how to use it in real world project ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions