All Projects → jirutka → asciidoctor-katex

jirutka / asciidoctor-katex

Licence: MIT license
Asciidoctor extension for converting latexmath using KaTeX at build time

Programming Languages

ruby
36898 projects - #4 most used programming language
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to asciidoctor-katex

Asciidoctor Html5s
Semantic HTML5 converter (backend) for Asciidoctor
Stars: ✭ 50 (+212.5%)
Mutual labels:  asciidoc, asciidoctor
Infoq Mini Book
Template project for creating an InfoQ Mini-Book with Asciidoctor
Stars: ✭ 147 (+818.75%)
Mutual labels:  asciidoc, asciidoctor
Kramdown Asciidoc
A kramdown extension for converting Markdown documents to AsciiDoc.
Stars: ✭ 97 (+506.25%)
Mutual labels:  asciidoc, asciidoctor
Asciidoctor.js
A JavaScript port of Asciidoctor, a modern implementation of AsciiDoc
Stars: ✭ 500 (+3025%)
Mutual labels:  asciidoc, asciidoctor
Asciidoctor Reveal.js
🔮 A reveal.js converter for Asciidoctor and Asciidoctor.js. Write your slides in AsciiDoc!
Stars: ✭ 219 (+1268.75%)
Mutual labels:  asciidoc, asciidoctor
Asciidoc Kate
AsciiDoc/AsciiDoctor syntax highlighting plugin for Kate editor/KatePart
Stars: ✭ 5 (-68.75%)
Mutual labels:  asciidoc, asciidoctor
Atom Asciidoc Preview
⚛ AsciiDoc preview for the Atom editor.
Stars: ✭ 136 (+750%)
Mutual labels:  asciidoc, asciidoctor
asciidoctor-lein-plugin
A Leiningen plugin for generating documentation using Asciidoctor
Stars: ✭ 26 (+62.5%)
Mutual labels:  asciidoc, asciidoctor
Asciidoctor Epub3
📘 Asciidoctor EPUB3 is a set of Asciidoctor extensions for converting AsciiDoc to EPUB3 & KF8/MOBI
Stars: ✭ 166 (+937.5%)
Mutual labels:  asciidoc, asciidoctor
Asciidoctor Browser Extension
⚪️ An extension for web browsers that converts AsciiDoc files to HTML using Asciidoctor.js.
Stars: ✭ 152 (+850%)
Mutual labels:  asciidoc, asciidoctor
Asciidoctor
💎 A fast, open source text processor and publishing toolchain, written in Ruby, for converting AsciiDoc content to HTML 5, DocBook 5, and other formats.
Stars: ✭ 3,905 (+24306.25%)
Mutual labels:  asciidoc, asciidoctor
Emacs Easy Hugo
Emacs major mode for managing hugo
Stars: ✭ 235 (+1368.75%)
Mutual labels:  asciidoc, asciidoctor
Doctoolchain
a Gradle based AsciiDoc Toolchain for Software Architecture Documentation
Stars: ✭ 355 (+2118.75%)
Mutual labels:  asciidoc, asciidoctor
Asciidoctor Pdf
📃 Asciidoctor PDF: A native PDF converter for AsciiDoc based on Asciidoctor and Prawn, written entirely in Ruby.
Stars: ✭ 868 (+5325%)
Mutual labels:  asciidoc, asciidoctor
Gradle Multi Project Example
Gradle 多项目管理示例
Stars: ✭ 283 (+1668.75%)
Mutual labels:  asciidoc, asciidoctor
Asciidocfx
Asciidoc Editor and Toolchain written with JavaFX 16 (Build PDF, Epub, Mobi and HTML books, documents and slides)
Stars: ✭ 1,533 (+9481.25%)
Mutual labels:  asciidoc, asciidoctor
middleman-asciidoc
🔰 AsciiDoc support for Middleman 4. (In Middleman 3, AsciiDoc support is provided by a core extension).
Stars: ✭ 24 (+50%)
Mutual labels:  asciidoc, asciidoctor
bitbucket-asciidoc-plugin
An add-on for Atlassian Bitbucket Server to render AsciiDoc files.
Stars: ✭ 20 (+25%)
Mutual labels:  asciidoc, asciidoctor
Ebook Template
Template to create PDF, ePub and Kindle books with Asciidoctor
Stars: ✭ 150 (+837.5%)
Mutual labels:  asciidoc, asciidoctor
Asciidoctor Web Pdf
Convert AsciiDoc documents to PDF using web technologies
Stars: ✭ 219 (+1268.75%)
Mutual labels:  asciidoc, asciidoctor

Asciidoctor KaTeX

CI Status Test Coverage Codacy Code quality Gem Version npm Version Yard Docs

This project provides an Asciidoctor extension for converting block and inline STEM in TeX notation (latexmath) to HTML using KaTeX library right during document conversion (instead of in browser on client-side).

Requirements

Ruby

Node.js

Installation

Ruby

Install asciidoctor-katex from Rubygems:

gem install asciidoctor-katex

or to install the latest development version:

gem install asciidoctor-katex --pre

Node.js

Install asciidoctor-katex from npmjs.com:

npm install --save asciidoctor-katex

Usage

CLI

If you invoke Asciidoctor from command-line, use option -r to load the extension:

asciidoctor -r asciidoctor-katex README.adoc

Ruby

Just require 'asciidoctor-katex'. However, if you don’t want the extension to be automatically registered in Asciidoctor, require 'asciidoctor/katex/treeprocessor' instead.

Important
Bundler automatically requires all the specified gems. To prevent it, use
gem 'asciidoctor-katex', require: false.

Node.js

// Load asciidoctor.js and asciidoctor-katex.
const asciidoctor = require('@asciidoctor/core')()
const asciidoctorKatex = require('asciidoctor-katex')

// See documentation at the end of this section.
const options = {
  katexOptions: {
    macros: {
      "\\RR": "\\mathbb{R}",
    },
  },
}

// Configure the extension and register it into global registry.
asciidoctorKatex.register(asciidoctor.Extensions, options)

// Convert the content to HTML.
const content = `
:stem: latexmath

Do some math: stem:[E = mc^2]
`
const html = asciidoctor.convert(content)
console.log(html)

You may also register the extension into a custom extensions registry:

const registry = asciidoctor.Extensions.create()
asciidoctorKatex.register(registry, options)
Options:
katex

The katex object to use for rendering. Defaults to require('katex').

requireStemAttr

Whether to require stem attribute to be defined (Asciidoctor’s standard behaviour). Set to false to process latexmath even when stem attribute is not defined. Default is true.
Note that the default stem type hard-coded by Asciidoctor is asciimath (not latexmath), so [stem] block and stem:[...] macro will not be rendered anyway (only [latexmath] block and latexmath:[...] macro).

katexOptions

The default options for katex.render(). Defaults to empty object.

License

This project is licensed under MIT License. For the full text of the license, see the LICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].