Skip to content

Commit

Permalink
Version 2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
goessner committed Jun 2, 2021
1 parent 1a952f4 commit 8bdb94c
Show file tree
Hide file tree
Showing 15 changed files with 445 additions and 443 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
node_modules
package-lock.json
test.md
test2.md
node_modules
Empty file removed .vscodeignore
Empty file.
28 changes: 24 additions & 4 deletions css/vscode-texmath.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
p { text-align: justify; }
p {
text-align: justify;
hyphens: auto;
}

table {
display: table !important;
width: auto !important;
margin-left: auto !important;
margin-right: auto !important;
margin-right: auto !important;
margin-bottom: 1em !important;
border-collapse: collapse !important;
}

Expand All @@ -22,9 +26,25 @@ figure > img {
display: block;
margin: 0 auto;
page-break-inside: avoid;
text-align: center;
}
figcaption {
display: block;
text-align: center;
font-size: 0.9em;
margin-top: 0.5em;
text-align: center;
}

aside {
font-size: 0.9em;
max-width: 300px;
padding: 0 0 0 1em;
margin: 0 0 0 1em;
float: right;
}

aside > *:first-child {
margin-top: 0;
}
aside > *:last-child {
margin-bottom: 0;
}
Binary file added docs/img/triangle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
409 changes: 212 additions & 197 deletions docs/publication.html

Large diffs are not rendered by default.

342 changes: 169 additions & 173 deletions docs/publication.md

Large diffs are not rendered by default.

Binary file added docs/publication.pdf
Binary file not shown.
12 changes: 5 additions & 7 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const ext = {
*/
asHTML(markdown) {
const usrcss = ext.cfg('style');
const theme = ext.cfg('default');
const theme = ext.cfg('theme');
const extPath = vscode.extensions.getExtension("goessner.mdmath").extensionPath;
const tmplturi = path.resolve(extPath, './themes/', theme, './theme.js');
const cssuri = path.resolve(extPath, './themes/', theme, './style.css');
Expand Down Expand Up @@ -180,16 +180,14 @@ exports.activate = function activate(context) {
extendMarkdownIt(md) {
const tm = require('markdown-it-texmath');
const delimiters = JSON.parse(JSON.stringify(ext.cfg('delimiters'))) || 'dollars'; // wondering why this JSON stuff is necessary ...
const katexOptions = JSON.parse(JSON.stringify(ext.cfg('katexoptions') || '')) || {};
const macros = ext.loadMacros();
const katexOptions = JSON.parse(JSON.stringify(ext.cfg('katexOptions') || ''))
|| macros && { macros }
|| {};
const outerSpace = ext.cfg('outerspace') || false;
const options = { "engine": require('katex'),
const options = { "engine": require('katex'),
"delimiters": delimiters,
"outerSpace": outerSpace,
"katexOptions": katexOptions
};
"katexOptions": macros && !katexOptions.macros ? Object.assign(katexOptions, macros) : katexOptions
};

(ext.mdit = md).use(tm, options);
return ext.mdit;
Expand Down
20 changes: 11 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"displayName": "Markdown+Math",
"description": "LaTeX Math for Markdown ... with macros and more",
"icon": "img/icon.png",
"version": "2.5.5",
"version": "2.6.0",
"author": "Stefan Goessner",
"publisher": "goessner",
"keywords": [
"TeX",
"LaTeX",
"KaTeX",
"markdown",
"markdown-it",
"markdown-it",
"math",
"multi-root ready"
],
Expand Down Expand Up @@ -50,7 +50,11 @@
"mdmath.theme": {
"type": "string",
"default": "default",
"enum": ["default", "minimal", "publication"],
"enum": [
"default",
"minimal",
"publication"
],
"description": "Choose from available themes ['default','minimal','publication']."
},
"mdmath.macros": {
Expand All @@ -62,13 +66,13 @@
"type": "string",
"default": "",
"description": "Absolute path of JSON file containing TeX macro definitions."
},
"mdmath.outerspace": {
},
"mdmath.outerspace": {
"type": "boolean",
"default": false,
"description": "Enclose inline math `$` pair with space characters, as a guard against misinterpretation of single `$`'s in normal markdown (default: `false` for backward compatibility)."
},
"mdmath.katexoptions": {
"mdmath.katexoptions": {
"type": "object",
"default": {},
"description": "Katex options definition. (see https://katex.org/docs/options.html)"
Expand Down
43 changes: 6 additions & 37 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
# ![mdmath](img/icon.png) Markdown+Math

[![License](https://img.shields.io/github/license/goessner/markdown-it-texmath.svg)](https://github.com/goessner/mdmath/blob/master/licence.txt)
[![npm](https://img.shields.io/npm/v/markdown-it-texmath.svg)](https://www.npmjs.com/package/markdown-it-texmath)
[![npm](https://img.shields.io/npm/dt/markdown-it-texmath.svg)](https://www.npmjs.com/package/markdown-it-texmath)
[![](https://data.jsdelivr.com/v1/package/npm/markdown-it-texmath/badge)](https://www.jsdelivr.com/package/npm/markdown-it-texmath)
# ![mdmath](https://github.com/goessner/mdmath/raw/master/img/icon.png) Markdown+Math

[![marketplace](https://vsmarketplacebadge.apphb.com/version/goessner.mdmath.svg)](https://marketplace.visualstudio.com/items?itemName=goessner.mdmath)
[![marketplace](https://vsmarketplacebadge.apphb.com/installs-short/goessner.mdmath.svg)](https://marketplace.visualstudio.com/items?itemName=goessner.mdmath)
[![License](https://img.shields.io/github/license/goessner/mdmath.svg)](https://github.com/goessner/mdmath/blob/master/LICENSE.txt)
[![npm](https://img.shields.io/npm/v/mdmath.svg)](https://www.npmjs.com/package/mdmath)
[![npm](https://img.shields.io/npm/dt/mdmath.svg)](https://www.npmjs.com/package/mdmath)


## What is it ...

Expand Down Expand Up @@ -63,7 +56,7 @@ document format.
* display: `$$...$$`
* display + equation number: `$$...$$ (1)`

![mdmath editing](./img/mdmath.gif)
![mdmath editing](https://github.com/goessner/mdmath/raw/master/./img/mdmath.gif)

## Installation ...

Expand Down Expand Up @@ -103,13 +96,12 @@ npm install
"mdmath.delimiters": "dollars",
"mdmath.macros": {},
"mdmath.macroFile": "",
"mdmath.katexOptions": {},
"mdmath.savePath": "./${file.name}.html",
"mdmath.autosave": false,
"mdmath.style": ""
```
### Example Settings
![mdmath example user settings](./img/usersettings.png)
![mdmath example user settings](https://github.com/goessner/mdmath/raw/master/./img/usersettings.png)

## Dependencies

Expand All @@ -120,8 +112,7 @@ npm install
* __How to define my own CSS file for HTML export ?__
* Define it by the user setting `mdmath.style` as an absolute URL. So for an example you might choose `mdmath.style: "file://c:/mystyle/mystyle.css"` with windows.
* __How to define and use macros ?__
* Note: **This is deprecated**. Prefer using KaTeX options (s. below).
Define them in user settings. For example ...
* Define them in user settings. For example ...
```json
"mdmath.macros": {
"\\RR": "\\mathbb{R}",
Expand All @@ -143,28 +134,6 @@ npm install
* User macro definition file has priority over user defined macro settings, which are ignored then.
* __Are there global predefined macros ?__
* No. Macros are user defined with user settings `mdmath.macros`. So they are available in all user specific markdown documents.
* __How to define and use Katex options ?__
* Define them in user settings. For example ...
```json
"mdmath.katexOptions": {
"leqno": true
}
```

* __Can I define and use macros in Katex options together with the ones in a user macro file?__
* Yes. Macros can be defined using `mdmath.macros` and `mdmath.macroFile` together with `mdmath.katexOptions`. For example...
```json
"mdmath.katexOptions": {
"leqno": true,
"macros": {
"\\RR": "\\mathbb{R}"
}
}
```
* Note: Prefer them over deprecated `macro` definition!
* Macros in `mdmath.katexOptions` have priority over those in `mdmath.macros` and `mdmath.macroFile`. So there is an 'either / or'!
* __Why don't I see changes in my preview window after editing Katex options?__
* Close your current windows and open new ones for the changes to be applied.
* __Can I write the HTML source to a file ?__
* Yes. Use the `Markdown: Save Markdown+Math to Html` command or the key binding <kbd>Ctrl</kbd>+<kbd>K</kbd><kbd>,</kbd>.
* The Html file is written to the folder where the markdown file resides in. This is the default.
Expand Down Expand Up @@ -225,11 +194,11 @@ The following folks helped to make `mdmath` even better.

## Contributing

See [`.github/CONTRIBUTING.md`](.github/CONTRIBUTING.md)
See [`.github/CONTRIBUTING.md`](https://github.com/goessner/mdmath/blob/master/.github/CONTRIBUTING.md)

## Changelog

See [`changelog.md`](changelog.md)
See [`changelog.md`](https://github.com/goessner/mdmath/blob/master/changelog.md)

## License

Expand Down
6 changes: 3 additions & 3 deletions syntaxes/dollars.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"injectionSelector": "meta.paragraph.markdown",
"patterns": [
{
"name":"block-dollars",
"begin": "(\\$\\$)",
"end": "(\\$\\$)",
"name":"pandoc-dollars",
"begin": "(^|\\s*)\\$\\$",
"end": "\\$\\$",
"contentName": "markup.inline.raw"
},
{
Expand Down
3 changes: 2 additions & 1 deletion themes/publication/style.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* microjam.latex.css
* mdmath.latex.css
*
* Inspired by: https://github.com/vincentdoerig/latex-css
*/
Expand Down Expand Up @@ -269,6 +269,7 @@ figure {
}
figcaption {
font-size: 0.95em;
text-align: center;
}

table {
Expand Down
2 changes: 1 addition & 1 deletion themes/publication/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ${data.tags ? `<meta name="keywords" content="${data.tags.join()}">` : ''}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlight.js/styles/vs.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex/dist/katex.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/markdown-it-texmath/css/texmath.min.css">
<link rel="stylesheet" href="${data.cssuri}">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/goessner/mdmath/themes/publication/style.css">
${data.usrcss ? `<link rel="stylesheet" href="${data.usrcss}">` : ''}
<title>${data.title}</title>
</head>
Expand Down
2 changes: 1 addition & 1 deletion triangle.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ $$a{\bold e}_\alpha + b\tilde{\bold e}_\alpha + c{\bold e}_x = \bold 0$$ (1)

with

$${\bold e}_\alpha = \begin{pmatrix}\cos\alpha\\ \sin\alpha\end{pmatrix} \quad and \quad \tilde{\bold e}_\alpha = \begin{pmatrix}-\sin\alpha\\ \cos\alpha\end{pmatrix}$$
$${\bold e}_\alpha = \begin{pmatrix}\cos\alpha\\ \sin\alpha\end{pmatrix} \quad and \quad {\tilde\bold e}_\alpha = \begin{pmatrix}-\sin\alpha\\ \cos\alpha\end{pmatrix}$$

Resolving for the hypothenuse part $c{\bold e}_x$ in the loop closure equation (1)

Expand Down

0 comments on commit 8bdb94c

Please sign in to comment.