Astro Theme Pure

Back

Other Integrations

Other integrations that help improve your site

medium-zoom#

Checkout medium-zoom for more.

src/site.config.ts
export const integ: IntegrationUserConfig = {
  // ...
  // A lightbox library that can add zoom effect
  mediumZoom: {
    enable: true, // disable it will not load the whole library
    selector: '.prose .zoomable',
    options: {
      className: 'zoomable'
    }
  }
}
ts

This theme has integrated it in BlogPost.astro by default, which means any content in src/content/blog doesn’t need to import. If you want to use it in any other layout or page, you can use the following code:

---
import { MediumZoom } from 'astro-pure/advanced'
---

<div class="prose">
  <img src="/path/to/image.jpg" class="zoomable" />
</div>

<MediumZoom />
{/* Or with configs */}
<MediumZoom
  selector=".prose .zoomable"
  background="rgba(0, 0, 0, 0.7)"
 />
astro

@playform/compress#

Checkout playform/compress for more.

@tailwindcss/typography#

Configure typography; configs are in tailwind.config.mjs.

tailwind.config.mjs
const typographyConfig = ({ theme }) => ({
  pure: {
    css: { 
      // ...
    }
  }
})
js

And it will be applied to class list configuration:

src/site.config.ts
export const integ: IntegrationUserConfig = {
  // ...
  typography: {
    class: 'prose prose-pure dark:prose-invert dark:prose-pure prose-headings:font-medium'
  }
}
ts

Checkout tailwindcss-typography for more.

Friend-Circle-Lite#

See Friend Links #Integrated with Friend-Circle-Lite.

LateX support#

In case any time in the future this theme removes default support for LateX, there’s a tutorial to help you add support for it.

Rendering LaTeX in Astro.js enriches your markdown files with mathematical expressions, making your content both engaging and informative. The following steps outline the necessary steps to integrate LaTeX into Astro.js and addresses potential pitfalls along with their solutions.

  1. Install Necessary Packages

    Begin by installing remark-math and rehype-katex. These packages parse and render LaTeX respectively. Use the install commands:

    bun install remark-math rehype-katex
    shell
  2. Configure Astro

    Modify your Astro configuration to use these plugins. Add the plugins to the markdown configuration section in your astro.config.mjs:

    astro.config.mjs
    import { defineConfig } from 'astro/config';
    import remarkMath from 'remark-math';
    import rehypeKatex from 'rehype-katex';
    
    export default defineConfig({
       // ...
       markdown: {
          remarkPlugins: [remarkMath],
          rehypePlugins: [rehypeKatex],
       },
    });
    js
  3. Include KaTeX CSS

    To ensure that LaTeX formulas are styled correctly, include the KaTeX CSS in your HTML layout (in this theme it would be in the BlogPost.astro file). Add the following css resources:

    src/layouts/BlogPost.astro
    ---
    import 'katex/dist/katex.min.css'
    ---
    astro

    Or use CDN to fasten speed:

    src/layouts/BlogPost.astro
    ---
    import config from '@/site-config'
    ---
    <link rel="stylesheet" href={`${config.npmCDN}/katex@0.16.15/dist/katex.min.css`}>
    astro

Common Pitfalls and Solutions:

  • CSS Styling Issues

    Problem: LaTeX formulas might not render with the correct styles if the KaTeX CSS isn’t loaded.

    Solution: Confirm the KaTeX stylesheet link is correctly placed in the HTML head and is loading without issues. Check for network errors or restrictions that might prevent the CSS from loading.

  • Build Errors

    Problem: Errors during build time when processing LaTeX syntax.

    Solution: Ensure that your LaTeX is correctly formatted and that there are no syntax errors in your markdown files. LaTeX syntax errors can break the parser and cause build failures.