Nanotechnology Promises Much

    astro-katex

    1.0.5 • Public • Published

    astro-katex NPM version

    astro-katex

    Astro component to auto-render math in element, based on Katex

    Math in astro markdown is not working with astro > 1.0.0-beta.31. #issue-3714

    Install | Try it now | Blog Demo

    $ npm install astro-katex katex

    Usage

    Before using astro-katex

    Add a new integration

    import katex from 'astro-katex';
    
    export default defineConfig({
      integrations: [ katex() ],
    });

    Math in element

    ---
    import AstroKatex from 'astro-katex/AstroKatex.astro'
    ---
    <AstroKatex is:raw>
      Look again at \(\textbf{Figure A} \) and \(\textbf{Figure B}\). Notice that in both graphs, as  \(x\)  approaches \(7\), the output values approach \(8\). This means
      \[
        \lim_{x \to 7} f(x) = \lim_{x \to 7} g(x)
      \]
    </AstroKatex>

    Output:

    Look again at $\textbf{Figure A}$ and $\textbf{Figure B}$. Notice that in both graphs, as $x$ approaches $7$, the output values approach $8$. This means $$\lim_{x \to 7} f(x) = \lim_{x \to 7} g(x)$$

    Using just an Expression

    ---
    import Expr from 'astro-katex/OnlyExpression.astro'
    ---
    
    A simple mathematical expression:
    <Expr>
        \sqrt{3x-1}+(1+x)^2
    </Expr>

    Output:

    A simple mathematical expression: $\sqrt{3x-1}+(1+x)^2$

    Options for Katex

    A number of options are now supported. For a comprehensive list please visit: here

    License

    MIT

    Note: Some $\LaTeX$ syntax may not be supported by KaTeX itself.

    Install

    npm i astro-katex

    DownloadsWeekly Downloads

    60

    Version

    1.0.5

    License

    MIT

    Unpacked Size

    4.75 kB

    Total Files

    6

    Last publish

    Collaborators

    • victor0x16