sanity-plugin-latex-input
TypeScript icon, indicating that this package has built-in type declarations

2.0.4 • Public • Published

LaTeX input for Sanity

This is a Sanity Studio v3 plugin. For the v2 version, please refer to the v2-branch.

What is it?

sanity-plugin-latex-input adds support for latex schema type, so it can be used in Portable Text Editor (PTE) in Sanity Studio.

latex-input preview

Installation

npm install --save sanity-plugin-latex-input

or

yarn add sanity-plugin-latex-input

Usage

Import and add the plugin to your studio config in sanity.config.ts (or .js):

import { latexBlock } from "sanity-plugin-latex-input";

export default defineConfig({
  /* ... */

  plugins: [
      latexInput()
  ]
})

You may now use the type name latex in your schema, such as in portable text.

Example schema definition for portable text

import React from 'react'
const mathInlineIcon = () => (
  <span>
    <span style={{ fontWeight: 'bold' }}>∑</span>b
  </span>
)
const mathIcon = () => <span style={{ fontWeight: 'bold' }}>∑</span>

export default {
  name: 'portableTextWithLatex',
  type: 'array',
  title: 'Body',
  of: [
    {
      type: 'block',
      title: 'Block',
      of: [
        { type: 'latex', icon: mathInlineIcon, title: 'Inline math' },
      ],
    },
    { type: 'latex', icon: mathIcon, title: 'Math block' },
  ],
}

The Portable Text editor will render a preview of the contents with KaTeX.

License

MIT-licensed. See LICENSE.

Develop & test

This plugin uses @sanity/plugin-kit with default configuration for build & watch scripts.

See Testing a plugin in Sanity Studio on how to run this plugin with hotreload in the studio.

Release new version

Run "CI & Release" workflow. Make sure to select the v3 branch and check "Release new version".

Semantic release will only release on configured branches, so it is safe to run release on any branch.

Readme

Keywords

Package Sidebar

Install

npm i sanity-plugin-latex-input

Weekly Downloads

518

Version

2.0.4

License

MIT

Unpacked Size

17 kB

Total Files

14

Last publish

Collaborators

  • drewsanity
  • refiito
  • sergeisarviro
  • ash
  • indrek.karner
  • cngonzalez-sanity
  • rdunk
  • rneatherway-sanity
  • ricokahler
  • pedro-sanity
  • jonabc
  • kenjonespizza
  • pauloborgesf
  • binoy14
  • simen.svale
  • svirs
  • josh_sanity_io
  • joneidejohnsen
  • nina.andal
  • rankers
  • snorreeb
  • mattcraig
  • vincentquigley
  • stipsan
  • michael-sanity
  • rubioz
  • tonina
  • ritasdias
  • simeonsanity
  • kmelve
  • bjoerge
  • rexxars
  • skogsmaskin
  • robinpyon
  • mariuslundgard
  • sanity-io
  • evenw
  • radhe_sanity
  • rbotten
  • judofyr
  • obliadp
  • dcilke
  • fredcarlsen
  • hermanw
  • sgulseth
  • atombender
  • thomax