-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(unified-latex-stringify): create unified latex stringify
- Loading branch information
0 parents
commit 6e7c08f
Showing
13 changed files
with
1,005 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"extends": ["../../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
} | ||
] | ||
} |
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,32 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/swcrc", | ||
"jsc": { | ||
"target": "es2017", | ||
"parser": { | ||
"syntax": "typescript", | ||
"decorators": true, | ||
"dynamicImport": true | ||
}, | ||
"transform": { | ||
"decoratorMetadata": true, | ||
"legacyDecorator": true | ||
}, | ||
|
||
"externalHelpers": true, | ||
"loose": true | ||
}, | ||
"module": { | ||
"type": "es6", | ||
"strict": true, | ||
"noInterop": true | ||
}, | ||
"sourceMaps": true, | ||
"exclude": [ | ||
"jest.config.ts", | ||
".*.spec.tsx?$", | ||
".*.test.tsx?$", | ||
"./src/jest-setup.ts$", | ||
"./**/jest-setup.ts$", | ||
".*.js$" | ||
] | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
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,76 @@ | ||
# unified-latex-stringify | ||
|
||
Plugin for `unified-latex` that takes an `unified-latex` tree and turns it into LaTeX | ||
|
||
## Contents | ||
|
||
- [unified-latex-stringify](#unified-latex-stringify) | ||
- [Contents](#contents) | ||
- [What is this?](#what-is-this) | ||
- [When should I use this?](#when-should-i-use-this) | ||
- [Install](#install) | ||
- [Use](#use) | ||
- [API](#api) | ||
- [Syntax tree](#syntax-tree) | ||
- [Types](#types) | ||
- [Compatibility](#compatibility) | ||
- [Security](#security) | ||
- [Related](#related) | ||
- [Contribute](#contribute) | ||
- [License](#license) | ||
|
||
## What is this? | ||
|
||
## When should I use this? | ||
|
||
## Install | ||
|
||
## Use | ||
|
||
## API | ||
|
||
## Syntax tree | ||
|
||
## Types | ||
|
||
## Compatibility | ||
|
||
## Security | ||
|
||
## Related | ||
|
||
## Contribute | ||
|
||
## License | ||
|
||
GPL-3.0-or-later © Thomas F. K. Jorna | ||
|
||
[unified]: https://unifiedjs.com | ||
[unifiedgh]: https://github.com/unifiedjs/unified | ||
[xast-from-xml]: https://github.com/syntax-tree/xast-util-from-xml | ||
[rehype]: https://github.com/rehypejs/rehype | ||
[rejour]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour | ||
[rejour-parse]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-parse | ||
[rejour-stringify]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-stringify | ||
[rejour-move-abstract]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-move-abstract | ||
[rejour-meta]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-meta | ||
[rejour-relatex]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/rejour-relatex | ||
[relatex]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex | ||
[relatex-parse]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex/relatex-parse | ||
[jast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/jast | ||
[jast-util-to-texast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/jast-util-to-texast | ||
[jastscript]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/rejour/jastscript | ||
[texast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex/texast | ||
[texast-util-to-latex]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/relatex/texast-util-to-latex | ||
[hast]: https://github.com/syntax-tree/hast | ||
[xast]: https://github.com/syntax-tree/xast | ||
[mdast]: https://github.com/syntax-tree/mdast | ||
[mdast-markdown]: https://github.com/syntax-tree/mdast-util-to-markdown | ||
[latex-utensils]: https://github.com/tamuratak/latex-utensils | ||
[latexjs]: https://github.com/latexjs/latexjs | ||
[reoff]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/reoff | ||
[reoff-parse]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/reoff/reoff-parse | ||
[reoff-rejour]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/reoff/reoff-rejour | ||
[ooxast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/ooxast/ooxast | ||
[ooxast]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/ooxast/ooxast-util-to-jast | ||
[unified-latex-stringify]: https://github.com/TrialAndErrorOrg/parsers/tree/main/libs/unified-latex-stringify |
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,23 @@ | ||
const config = { | ||
displayName: 'unified-latex-stringify', | ||
preset: '../../../jest.preset.js', | ||
globals: { | ||
'ts-jest': { | ||
tsconfig: '<rootDir>/tsconfig.spec.json', | ||
useESM: true, | ||
}, | ||
}, | ||
testEnvironment: 'node', | ||
transform: { | ||
'^.+\\.[tj]sx?$': ['@swc/jest', { swcrc: false }], | ||
}, | ||
transformIgnorePatterns: [], | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], | ||
coverageDirectory: '../../../coverage/libs/unified-latex-stringify', | ||
extensionsToTreatAsEsm: ['.ts'], | ||
moduleNameMapper: { | ||
'^(\\.{1,2}/.*)\\.js$': '$1', | ||
}, | ||
} | ||
|
||
export default config |
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,36 @@ | ||
{ | ||
"name": "unified-latex-stringify", | ||
"version": "0.0.1", | ||
"license": "GPL-3.0-or-later", | ||
"repository": "https://github.com/TrialAndErrorOrg/unified-latex-stringify", | ||
"homepage": "https://github.com/TrialAndErrorOrg/parsers", | ||
"author": "Thomas F. K. Jorna <[email protected]>", | ||
"type": "module", | ||
"description": "Plugin for `unified-latex` that takes an `unified-latex` tree and turns it into LaTeX", | ||
"keywords": [ | ||
"unified", | ||
"unified-latex", | ||
"stringify", | ||
"latex", | ||
"ast" | ||
], | ||
"typedoc": { | ||
"entryPoint": "./src/index.ts", | ||
"readmeFile": "./README.md", | ||
"displayName": "unified-latex-stringify", | ||
"tsconfig": "./tsconfig.lib.json" | ||
}, | ||
"exports": { | ||
".": { | ||
"types": "./index.d.ts", | ||
"import": "./index.js" | ||
} | ||
}, | ||
"main": "./index.js", | ||
"types": "./index.d.ts", | ||
"files": [ | ||
"index.d.ts", | ||
"index.js", | ||
"./lib" | ||
] | ||
} |
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,82 @@ | ||
{ | ||
"name": "unified-latex-stringify", | ||
"$schema": "../../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "libs/unified-latex/unified-latex-stringify/src", | ||
"projectType": "library", | ||
"targets": { | ||
"build": { | ||
"executor": "better-nx-tsc:tsc", | ||
"outputs": ["{options.outputPath}"], | ||
"options": { | ||
"rootDir": "libs/unified-latex/unified-latex-stringify/src", | ||
"outputPath": "dist/libs/unified-latex/unified-latex-stringify", | ||
"tsConfig": "libs/unified-latex/unified-latex-stringify/tsconfig.lib.json", | ||
"packageJson": "libs/unified-latex/unified-latex-stringify/package.json", | ||
"main": "libs/unified-latex/unified-latex-stringify/src/index.ts", | ||
"assets": ["libs/unified-latex/unified-latex-stringify/*.md"], | ||
"updateBuildableProjectDepsInPackageJson": true, | ||
"clean": true, | ||
"buildableProjectDepsInPackageJsonType": "dependencies" | ||
}, | ||
"dependsOn": [ | ||
{ | ||
"projects": "dependencies", | ||
"target": "build", | ||
"params": "forward" | ||
}, | ||
{ | ||
"projects": "self", | ||
"target": "lint" | ||
} | ||
] | ||
}, | ||
"npm": { | ||
"executor": "ngx-deploy-npm:deploy", | ||
"options": { | ||
"access": "public" | ||
} | ||
}, | ||
"version": { | ||
"executor": "@jscutlery/semver:version", | ||
"options": { | ||
"trackDeps": true, | ||
"postTargets": [ | ||
"unified-latex-unified-latex-stringify:npm", | ||
"unified-latex-unified-latex-stringify:github", | ||
"unified-latex-unified-latex-stringify:github-standalone" | ||
] | ||
}, | ||
"dependsOn": [ | ||
{ | ||
"target": "version", | ||
"projects": "dependencies", | ||
"params": "forward" | ||
} | ||
] | ||
}, | ||
"github": { | ||
"executor": "@jscutlery/semver:github", | ||
"options": { | ||
"tag": "${tag}", | ||
"notes": "${notes}", | ||
"repo": "TrialAndErrorOrg/docx-to-vfile" | ||
} | ||
}, | ||
"github-standalone": { | ||
"executor": "@jscutlery/semver:github", | ||
"options": { | ||
"tag": "${tag}", | ||
"notes": "${notes}", | ||
"repo": "TrialAndErrorOrg/unified-latex-unified-latex-stringify" | ||
} | ||
}, | ||
"readme": { | ||
"executor": "@jote/readme:update-readme", | ||
"options": { | ||
"readme": "libs/unified-latex/unified-latex-stringify/README.md", | ||
"packageJSON": "libs/unified-latex/unified-latex-stringify/package.json" | ||
} | ||
} | ||
}, | ||
"tags": [] | ||
} |
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 @@ | ||
export { default } from './lib/unified-latex-stringify.js' |
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,7 @@ | ||
import unifiedLatexStringify from './unified-latex-stringify.js' | ||
|
||
describe('unifiedLatexStringify', () => { | ||
it('should work', () => { | ||
expect(unifiedLatexStringify).toBeDefined() | ||
}) | ||
}) |
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,15 @@ | ||
import { toString } from '@unified-latex/unified-latex-util-to-string' | ||
import { Root, Node } from '@unified-latex/unified-latex-types/' | ||
|
||
import { CompilerFunction, Plugin } from 'unified' | ||
|
||
const unifiedLatexStringify = function unifiedLatexStringify() { | ||
const compiler: CompilerFunction<Node, string> = (tree) => { | ||
// Assume options. | ||
return toString(tree) | ||
} | ||
|
||
Object.assign(this, { Compiler: compiler }) | ||
} as Plugin<void[], Root, string> | ||
|
||
export default unifiedLatexStringify |
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 @@ | ||
{ | ||
"extends": "../../../tsconfig.base.json", | ||
"files": [], | ||
"include": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.lib.json" | ||
}, | ||
{ | ||
"path": "./tsconfig.spec.json" | ||
} | ||
] | ||
} |
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,10 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../../dist/out-tsc", | ||
"declaration": true, | ||
"types": ["node"] | ||
}, | ||
"exclude": ["**/*.spec.ts", "**/*.test.ts", "jest.config.ts"], | ||
"include": ["src/**/*.ts"] | ||
} |
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,18 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../../dist/out-tsc", | ||
"types": ["jest", "node"] | ||
}, | ||
"include": [ | ||
"**/*.test.ts", | ||
"**/*.spec.ts", | ||
"**/*.test.tsx", | ||
"**/*.spec.tsx", | ||
"**/*.test.js", | ||
"**/*.spec.js", | ||
"**/*.test.jsx", | ||
"**/*.spec.jsx", | ||
"**/*.d.ts", | ||
] | ||
} |