Skip to content

Comments

Minor change to the Module development guide#572

Merged
markdumay merged 4 commits intogethinode:mainfrom
oolonek:main
Jan 4, 2025
Merged

Minor change to the Module development guide#572
markdumay merged 4 commits intogethinode:mainfrom
oolonek:main

Conversation

@oolonek
Copy link
Contributor

@oolonek oolonek commented Jan 1, 2025

Added the following instructions:

Make sure to keep the existing workspace = "mod-katex.work" line from the template. Pay attention to also rename the mod-template.work file to mod-katex.work in the exampleSite directory.

I am not sure wether I had missed a step but I needed to manually rename the mod-template.work file to mod-katex.work in the exampleSite directory, so I also mentioned it in the docs.

@netlify
Copy link

netlify bot commented Jan 1, 2025

Deploy Preview for gethinode-docs ready!

Name Link
🔨 Latest commit 561cbe6
🔍 Latest deploy log https://app.netlify.com/sites/gethinode-docs/deploys/677552c12f064f0008ac9d4f
😎 Deploy Preview https://deploy-preview-572--gethinode-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 93 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@markdumay markdumay left a comment

Choose a reason for hiding this comment

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

I appreciate your suggestion. The module guide is outdated, as the module template uses workspaces instead of replacements nowadays. I'd suggest the following content as a replacement. Please feel free to change your PR accordingly.

NB: GH has trouble rendering nested code blocks, you can copy everything below ---.


## Step 4 - Testing the KaTeX markup

The module template provides a simple website for local testing. Open the file `exampleSite/hugo.toml` and update the configuration:

```toml
  # Build and serve using local mod-katex clone declared in the named Hugo workspace:
  workspace = "mod-katex.work"
  [[module.mounts]]
    source = "static"
    target = "static"
  [[module.imports]]
    path = "github.com/gethinode/mod-katex"
  [[module.imports.mounts]]
    source = "dist/katex.scss"
    target = "static/katex.css"
  [[module.imports.mounts]]
    source = "dist/fonts"
    target = "static/fonts"
  [[module.imports.mounts]]
    source = "dist/katex.js"
    target = "static/js/katex.js"
  [[module.imports.mounts]]
    source = "dist/contrib/auto-render.js"
    target = "static/js/auto-render.js"
  [[module.imports.mounts]]
    source = "assets/js/modules/katex/katex-autoload.js"
    target = "static/js/katex-autoload.js"
  [[module.imports.mounts]]
    source = 'layouts'
    target = 'layouts'

The configuration uses a workspace to simplify local development. Rename the existing template file from mod-template.work to mod-katex.work for consistency. Ensure you reference the correct file in the above configuration.

Workspaces are of great help for local development and testing, as we would otherwise need to synchronize our repositories, submit a PR, and pull the latest version for each revision. The next line instructs our example site to use the mod-katex module (now sourced locally) and to adjust the mount points of the .css file and .js files. In this simple site for testing, we have no need for complex processing or bundling of assets, so we can use static imports instead.

@markdumay markdumay merged commit cf7f4b7 into gethinode:main Jan 4, 2025
11 checks passed
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