/
githubmirror
/
julia
Обзор
Документация
Войти
/
githubmirror
/
julia
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
stdlib/Markdown/src/IPython/IPython.jl
32 строки
756 B
Shuhei Kadowaki
Markdown: Make `Table`/`LaTeX` objects subtypes of `MarkdownElement` (#58916)
07 июл 2025, 17:49
Не верифицирован
07 июл 2025, 17:49
958d758
Код
Авторство
О чём код?
# This file is a part of Julia. License is MIT: https://julialang.org/license mutable struct LaTeX <: MarkdownElement formula::String end @trigger '$' -> function tex(stream::IO, md::MD) result = parse_inline_wrapper(stream, "\$", rep = true) return result === nothing ? nothing : LaTeX(result) end function blocktex(stream::IO, md::MD) withstream(stream) do ex = tex(stream, md) if ex ≡ nothing return false else push!(md, ex) return true end end end show(io::IO, tex::LaTeX) = print(io, '$', tex.formula, '$') latex(io::IO, tex::LaTeX) = println(io, "\$\$", tex.formula, "\$\$") latexinline(io::IO, tex::LaTeX) = print(io, '$', tex.formula, '$')