Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: use diplodoc/latex-extension instead of markdown-it-katex #184

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

d3m1d0v
Copy link
Member

@d3m1d0v d3m1d0v commented Feb 6, 2024

  • added packages to peerDependencies: @diplodoc/latex-extension, katex, markdown-it
  • editor's Math extension now use @diplodoc/latex-extension instead of markdown-it-katex
  • Math extension removed from YfmPreset/YfmSpecsPreset and package root export
  • added options to Math extension

Example of using a Math extension:

import {Math} from '@doc-tools/yfm-editor/_/extensions/yfm/Math';

// ...

builder.use(Math, {
  // required
  loadRuntimeScript: async () => {
    await Promise.all([
      import('@diplodoc/latex-extension/runtime'),
      import('@diplodoc/latex-extension/runtime/styles'),
    ]);
  },
  // optional; if you need custom sanitizing
  sanitize: (html) => /* sanitize html */ html,
  // optional; options to be passed to katex
  katexOptions: {},
});

@d3m1d0v d3m1d0v requested a review from smsochneg February 6, 2024 08:47
@yc-ui-bot
Copy link
Contributor

Preview is ready.

- added packages to peerDependencies: `@diplodoc/latex-extension`, `katex`, `markdown-it`
- editor's Math extension now use `@diplodoc/latex-extension` instead of `markdown-it-katex`
- Math extension removed from YfmPreset/YfmSpecsPreset
- added options to Math extension

Example of using a Math extension:

```js
import {Math} from '@doc-tools/yfm-editor/_/extensions/yfm/Math';

// ...

builder.use(Math, {
  // required
  loadRuntimeScript: async () => {
    await Promise.all([
      import('@diplodoc/latex-extension/runtime'),
      import('@diplodoc/latex-extension/runtime/styles'),
    ]);
  },
  // optional; if you need custom sanitizing
  sanitize: (html) => /* sanitize html */ html,
  // optional; options to be passed to katex
  katexOptions: {},
});
```
@d3m1d0v d3m1d0v force-pushed the diplodoc-latex-extension branch from 1b7f439 to ee2237a Compare February 6, 2024 09:40
@d3m1d0v d3m1d0v merged commit 80ad40f into master Feb 6, 2024
2 checks passed
@d3m1d0v d3m1d0v deleted the diplodoc-latex-extension branch February 6, 2024 10:03
makhnatkin pushed a commit that referenced this pull request May 28, 2024
- added packages to peerDependencies: `@diplodoc/latex-extension`, `katex`, `markdown-it`
- editor's Math extension now use `@diplodoc/latex-extension` instead of `markdown-it-katex`
- Math extension removed from YfmPreset/YfmSpecsPreset and package root export
- added options to Math extension

Example of using a Math extension:

```js
import {Math} from '@doc-tools/yfm-editor/_/extensions/yfm/Math';

// ...

builder.use(Math, {
  // required
  loadRuntimeScript: async () => {
    await Promise.all([
      import('@diplodoc/latex-extension/runtime'),
      import('@diplodoc/latex-extension/runtime/styles'),
    ]);
  },
  // optional; if you need custom sanitizing
  sanitize: (html) => /* sanitize html */ html,
  // optional; options to be passed to katex
  katexOptions: {},
});
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants