Skip to content

Commit

Permalink
fix and package settings
Browse files Browse the repository at this point in the history
  • Loading branch information
SeppiaBrilla committed Oct 21, 2023
1 parent cb933fe commit 140db1b
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dist/*
lib/*
node_modules/*

4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ tests/
.git
jest.config.js
node_modules/
.github
tsconfig-cjs.json
.npmignore
.eslintrc.cjs
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "WebObsidianBuilder",
"version": "0.1.0",
"description": "A typescript library to transform Obsidian notes into html",
"main": "index.js",
"types": "dist/index.d.ts",
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
"author": "SeppiaBrilla <[email protected]>",
"keywords": [
"Obsidian",
Expand All @@ -15,10 +15,11 @@
"marked": "^9.0.1"
},
"scripts": {
"build": "tsc --build",
"build": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
"clean": "tsc --build --clean",
"test": "jest",
"check": "npx eslint src/"
"check": "npx eslint src/",
"prepublishOnly": "npm run build"
},
"devDependencies": {
"@types/jest": "^29.5.5",
Expand Down
6 changes: 3 additions & 3 deletions src/ObsidianElements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface Element{
Id:string;
}

const MathClass = "WebObsidianMath InlineMath";
const MathClass = "ObsidianMath";

class MathElement implements Element{
public Value: string;
Expand All @@ -20,9 +20,9 @@ class MathElement implements Element{
"displayMode":display,
"output":"htmlAndMathml",
"throwOnError": false
}).replace('aria-hidden="true"',`aria-hidden="true" class:"${MathClass}"`);
}).replace('class="katex-html" aria-hidden="true"',`class="katex-html ${MathClass}" aria-hidden="true"`);
if(!display)
this.Value = this.Value.replace('display="block"','');
this.Value = this.Value.replaceAll('display="block"','');
this.Id = id;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/WebObsidianBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class WebObsidianBuilder{
let css = "";
if(this.Mathcss){
css += `.${MathClass}{
visibility: hidden;
display: none;
}`;
}
return css;
Expand Down Expand Up @@ -110,7 +110,7 @@ visibility: hidden;
private ConvertInlineMathElement(element:MarkdownElement, mdString:string): string{
const id: string = randomUUID();
const currentMath:string = element.Value;
this.Elements.push(new MathElement(currentMath, id, true));
this.Elements.push(new MathElement(currentMath, id, false));
return mdString.replace(`$${currentMath}$`, id);
}

Expand Down
7 changes: 7 additions & 0 deletions tsconfig-cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions":{
"module":"commonJS",
"outDir":"./lib/cjs"
}
}
10 changes: 6 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"target": "ES2016",
"module": "ES2020",
"forceConsistentCasingInFileNames": true,
"strict": true,
"declaration":true,
"skipLibCheck": true,
"outDir":"dist/",
"esModuleInterop":true,
"outDir":"./lib/esm",
"lib": [
"ES2021.String"
]
},
"include": [
"src/"
"./src"
]
}

0 comments on commit 140db1b

Please sign in to comment.