discourse/plugins/discourse-math/lib/discourse_math/bundle_paths.rb
Sam d31ca17c57
FEATURE: update mathjax to version 4.1 (#36814)
This upgrades to Mathjax 4.1 and latest katex
Implement rich text composer support for math
Adds support for /( )/ and /[ /] which was missing and very common now 
Removes math javascript from our repo

---------

Co-authored-by: Mark McClure <mcmcclur@unca.edu>
2026-01-09 08:24:31 +11:00

34 lines
927 B
Ruby

# frozen_string_literal: true
require "fileutils"
module DiscourseMath
module BundlePaths
PLUGIN_NAME = "discourse-math"
PUBLIC_DIR = File.expand_path("../../public", __dir__)
def self.bundle_version
DiscourseMathBundle::VERSION
end
def self.public_version_dir
File.join(PUBLIC_DIR, bundle_version)
end
def self.public_url_base
"/plugins/#{PLUGIN_NAME}/#{bundle_version}"
end
def self.ensure_public_symlinks
FileUtils.mkdir_p(public_version_dir)
ensure_symlink(File.join(public_version_dir, "mathjax"), DiscourseMathBundle.mathjax_path)
ensure_symlink(File.join(public_version_dir, "katex"), DiscourseMathBundle.katex_path)
end
def self.ensure_symlink(link_path, target_path)
return if File.symlink?(link_path) && File.readlink(link_path) == target_path
Discourse::Utils.atomic_ln_s(target_path, link_path)
end
end
end