-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 fix redundant $$ symbols in some kind of formulas in .html
- Loading branch information
Showing
16 changed files
with
2,094 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/dist | ||
/node_modules | ||
/coverage | ||
/lua/main.lua | ||
/.env.local | ||
/.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
|
||
|
||
function Para(el) | ||
local content = {} | ||
local in_display_math = false | ||
for _, item in pairs(el.content) do | ||
if item.t == 'Str'and item.text == "$$" then | ||
in_display_math = not in_display_math | ||
else | ||
if in_display_math then | ||
if item.t == 'RawInline' and item.format == 'tex' then | ||
local n = pandoc.Math('DisplayMath', '\n' .. item.text .. '\n') | ||
table.insert(content, n) | ||
elseif (item.t ~= 'SoftBreak') then | ||
table.insert(content, item) | ||
end | ||
else | ||
table.insert(content, item) | ||
end | ||
end | ||
end | ||
el.content = content | ||
return el | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,37 @@ | ||
{ | ||
"name": "obsidian-enhancing-export", | ||
"version": "1.0.7", | ||
"description": "This is a enhancing export plugin for Obsidian. It allows to export to formats like Html, DOCX, ePub and PDF or Markdown(Hugo) etc.", | ||
"main": "dist/main.js", | ||
"scripts": { | ||
"dev": "node esbuild.config.mjs", | ||
"build": "node esbuild.config.mjs production", | ||
"name": "obsidian-enhancing-export", | ||
"version": "1.0.8", | ||
"description": "This is a enhancing export plugin for Obsidian. It allows to export to formats like Html, DOCX, ePub and PDF or Markdown(Hugo) etc.", | ||
"main": "dist/main.js", | ||
"scripts": { | ||
"dev": "node esbuild.config.mjs", | ||
"build": "node esbuild.config.mjs production", | ||
"version": "node version-bump.mjs && git add manifest.json versions.json", | ||
"lint": "eslint --ext .ts,.js src build", | ||
"lint-fix": "eslint --fix --ext .ts,.js src build gulpfile.js", | ||
"format-check": "prettier --check \"src/**/*.ts\"", | ||
"format-fix": "prettier --write \"src/**/*.ts\"" | ||
}, | ||
"keywords": [], | ||
"author": "YISH", | ||
"license": "MIT", | ||
"lint": "eslint --ext .ts,.js src build", | ||
"lint-fix": "eslint --fix --ext \"src/**/*.ts\"", | ||
"format-check": "prettier --check \"src/**/*.ts\"", | ||
"format-fix": "prettier --write \"src/**/*.ts\"", | ||
"test": "jest" | ||
}, | ||
"keywords": [], | ||
"author": "YISH", | ||
"license": "MIT", | ||
"repository": "https://github.com/mokeyish/obsidian-enhancing-export", | ||
"devDependencies": { | ||
"@types/node": "^16.11.6", | ||
"@typescript-eslint/eslint-plugin": "^5.18.0", | ||
"@typescript-eslint/parser": "^5.18.0", | ||
"builtin-modules": "^3.2.0", | ||
"dotenv": "^16.0.0", | ||
"esbuild": "0.14.34", | ||
"esbuild-plugin-copy": "^1.3.0", | ||
"eslint": "^8.13.0", | ||
"obsidian": "latest", | ||
"prettier": "^2.6.2", | ||
"tslib": "2.3.1", | ||
"typescript": "4.6.3" | ||
} | ||
"devDependencies": { | ||
"@types/jest": "^27.5.1", | ||
"@types/node": "^16.11.6", | ||
"@typescript-eslint/eslint-plugin": "^5.18.0", | ||
"@typescript-eslint/parser": "^5.18.0", | ||
"builtin-modules": "^3.2.0", | ||
"dotenv": "^16.0.0", | ||
"esbuild": "0.14.34", | ||
"esbuild-plugin-copy": "^1.3.0", | ||
"eslint": "^8.13.0", | ||
"jest": "^28.1.0", | ||
"obsidian": "latest", | ||
"prettier": "^2.6.2", | ||
"ts-jest": "^28.0.2", | ||
"tslib": "2.3.1", | ||
"typescript": "4.6.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { exec as execSync, ExecException } from 'child_process'; | ||
import os from 'os'; | ||
|
||
|
||
export async function exec(cmd: string, options: { lineSeparator: '\n' | '\r\n' | '\r' }): Promise<string> { | ||
function lineSeparator(s?: string, ls?: '\n' | '\r\n' | '\r') { | ||
if (!s || os.EOL === ls || !ls) { | ||
return s; | ||
} | ||
return s.replaceAll(os.EOL, ls); | ||
} | ||
return await new Promise((resolve, reject) => { | ||
execSync(cmd, { encoding: 'utf-8', cwd: module.path }, (e: ExecException, stdout: string, stderr: string) => { | ||
if (!e) { | ||
resolve(lineSeparator(stdout, options?.lineSeparator)); | ||
} else { | ||
reject(lineSeparator(stderr, options?.lineSeparator)); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
$$ | ||
\begin{align*} | ||
\begin{rcases} | ||
\lambda_{1}(a_{11}^{*}, \ldots, a_{22}^{*}) < 0 \\ | ||
\lambda_{2}(a_{11}^{*}, \ldots, a_{22}^{*}) < 0 \\ | ||
\end{rcases} & \Rightarrow \text{stable knot} \\ | ||
\begin{rcases} | ||
\lambda_{1}(a_{11}^{*}, \ldots, a_{22}^{*}) > 0 \\ | ||
\lambda_{2}(a_{11}^{*}, \ldots, a_{22}^{*}) < 0 \\ | ||
\end{rcases} & \Rightarrow \text{saddle} | ||
\end{align*} | ||
$$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Pandoc | ||
Meta { unMeta = fromList [] } | ||
[ Para | ||
[ Math | ||
DisplayMath | ||
"\n\\begin{align*}\n\\begin{rcases}\n\\lambda_{1}(a_{11}^{*}, \\ldots, a_{22}^{*}) < 0 \\\\\n\\lambda_{2}(a_{11}^{*}, \\ldots, a_{22}^{*}) < 0 \\\\\n\\end{rcases} & \\Rightarrow \\text{stable knot} \\\\\n\n \\begin{rcases}\n \\lambda_{1}(a_{11}^{*}, \\ldots, a_{22}^{*}) > 0 \\\\\n \\lambda_{2}(a_{11}^{*}, \\ldots, a_{22}^{*}) < 0 \\\\\n \\end{rcases} & \\Rightarrow \\text{saddle}\n\\end{align*}\n" | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { exec } from './common'; | ||
import { readFile } from 'fs/promises'; | ||
|
||
|
||
test('test math block parsing', async () => { | ||
process.chdir(module.path); | ||
const input_file = './markdowns/math-block.md'; | ||
const expect_out = './markdowns/math-block.out'; | ||
const lua_script = '../lua/math_block.lua'; | ||
const pandoc = `pandoc -s -L ${lua_script} -t native -f markdown "${input_file}"`; | ||
const ret = await exec(pandoc, { lineSeparator: '\n'}); | ||
// await writeFile('./out.txt', ret); | ||
expect(ret).toBe(await readFile(expect_out, { encoding: 'utf-8', flag: 'r' })); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
"1.0.4": "0.12.0", | ||
"1.0.5": "0.12.0", | ||
"1.0.6": "0.12.0", | ||
"1.0.7": "0.12.0" | ||
"1.0.7": "0.12.0", | ||
"1.0.8": "0.12.0" | ||
} |
Oops, something went wrong.