
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@aomao/plugin-math
Advanced tools
数学公式
$ yarn add @aomao/plugin-math
添加到引擎
import Engine, { EngineInterface } from '@aomao/engine';
import Math , { MathComponent } from '@aomao/plugin-math';
new Engine(...,{ plugins:[ Math ] , cards:[ MathComponent ]})
Math 可选项//使用配置
new Engine(...,{
config:{
[Math.pluginName]:{
//...相关配置
}
}
})
action: 请求地址,始终使用 POST 请求
type: 默认为 json
contentType: 默认以 application/json 类型发起请求
data: 请求时将这些数据一起POST到服务端
/**
* 请求生成公式svg地址
*/
action: string;
/**
* 数据返回类型,默认 json
*/
type?: '*' | 'json' | 'xml' | 'html' | 'text' | 'js';
/**
* 额外携带数据上传
*/
data?: Record<string, RequestDataValue> | FormData | (() => Promise<Record<string, RequestDataValue> | FormData>)
/**
* 请求类型,默认 application/json;
*/
contentType?: string;
配置后,插件会使用 content 字段 POST 到指定的 action 地址,里面包含了公式代码
默认会查找
公式对应图片地址或SVG代码:response.url || response.data && response.data.url
result: true 生成成功,data 为公式对应图片地址或SVG代码。false 生成失败,data 为错误消息
/**
* 解析生成后的Respone,返回 result:是否成功,data:成功:公式对应图片地址或`SVG`代码,失败:错误信息
*/
parse?: (
response: any,
) => {
result: boolean;
data: string;
};
可以使用 https://g.aomao.com/latex 地址生成公式对应的 SVG 代码。该项目使用mathjax 生成 SVG 代码
演示站点:https://drawing.aomao.com/
配置:
[Math.pluginName]: {
action: `https://g.aomao.com/latex`,
parse: (res: any) => {
if(res.success) return { result: true, data: res.svg}
return { result: false}
}
}
参数 1:公式代码
参数 2:公式对应图片地址或SVG代码
engine.command.execute(
Math.pluginName,
'公式代码', //可选
'公式对应图片地址或`SVG`代码', //可选
);
参数 1:固定为 query
参数 2:成功后的回调
参数 3:失败后的回调。可选
engine.command.execute(Math.pluginName, "query", success:(url: string) => void, failed: (message: string) => void);
FAQs
Math(数学公式)
We found that @aomao/plugin-math demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.