Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sanity-io/latex-input
LaTeX input for Sanity
https://github.com/sanity-io/latex-input
team-ecosystem
Last synced: 27 days ago
JSON representation
LaTeX input for Sanity
- Host: GitHub
- URL: https://github.com/sanity-io/latex-input
- Owner: sanity-io
- License: mit
- Created: 2017-10-02T12:52:35.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2024-05-22T18:46:06.000Z (6 months ago)
- Last Synced: 2024-05-22T21:32:23.201Z (6 months ago)
- Topics: team-ecosystem
- Language: TypeScript
- Homepage:
- Size: 3.85 MB
- Stars: 11
- Watchers: 5
- Forks: 6
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-sanity - `sanity-plugin-latex-input` - Enables LaTeX math forumla input with preview capabilities (Plugins)
README
# LaTeX input for Sanity
> This is a **Sanity Studio v3** plugin.
> For the v2 version, please refer to the [v2-branch](https://github.com/sanity-io/latex-input/tree/studio-v2).## 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](assets/latex-input.png)
## Installation
```sh
npm install --save sanity-plugin-latex-input
```or
```sh
yarn add sanity-plugin-latex-input
```## Usage
Import and add the plugin to your studio config in sanity.config.ts (or .js):
```ts
import { latexInput } 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 = () => (
∑b
)
const mathIcon = () => ∑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](https://github.com/sanity-io/plugin-kit)
with default configuration for build & watch scripts.See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)
on how to run this plugin with hotreload in the studio.### Release new version
Run ["CI & Release" workflow](https://github.com/sanity-io/latex-input/actions/workflows/main.yml).
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.