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

PR into master from dev/olga/add-applyMathpixMarkdownPlugins #350

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

OlgaRedozubova
Copy link
Contributor

@OlgaRedozubova OlgaRedozubova commented Oct 18, 2024

branch: dev/olga/add-applyMathpixMarkdownPlugins

  • Added the function applyMathpixMarkdownPlugins
  • Set version 2.0.5
  • Added test to check the function applyMathpixMarkdownPlugins
  • Updated README
import { applyMathpixMarkdownPlugins } from 'mathpix-markdown-it';

const md = applyMathpixMarkdownPlugins({
  htmlTags: true,
});

// We use a configured instance for Parsing Markdown
const renderedHtml = md.render('Your **Markdown** text with \\textbf{mathpix-markdown-it} support!');
console.log(renderedHtml);

renderedHtml:

<div>Your <strong>Markdown</strong> text with <strong>mathpix-markdown-it</strong> support!</div>

@OlgaRedozubova OlgaRedozubova self-assigned this Oct 18, 2024
@sylee957
Copy link

I'm okay with the implementation. But user-facing documentation may be added to readme.

@OlgaRedozubova
Copy link
Contributor Author

I'm okay with the implementation. But user-facing documentation may be added to readme.

Sure, I'll do it.

@OlgaRedozubova OlgaRedozubova marked this pull request as ready for review October 18, 2024 12:41
@sylee957
Copy link

Can you add type MarkdownIt for function output?

@OlgaRedozubova
Copy link
Contributor Author

Can you add type MarkdownIt for function output?

Done.


export const applyMathpixMarkdownPlugins = (options: TMarkdownItOptions = {}): MarkdownIt => {
let md: MarkdownIt = mdInit(options);
md = injectRenderRules(md);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it could better to change injectRenderRules to infer the type for MarkdownIt
injectRenderRules = (renderer: MarkdownIt) => {

@sylee957
Copy link

I still have problem for inferring the types for markdown-it.
Maybe you should add @types/markdown-it and add import
import type MarkdownIt from "markdown-it";

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.

2 participants