Skip to content

Add Support for Custom Language Grammars in processMarkdown #11

Closed
@jasonnathan

Description

@jasonnathan

Hey there, I initially thought about forking the package to add a small feature but decided it would be cleaner to refactor it a little instead. I've already created a PR with the changes but thought I'd open an issue first to discuss.

I've added support for consumers of the package to pass custom language grammars via a langConfig option. This allows extending the syntax highlighting without modifying the core library.

Usage

import langLua from "shiki/langs/lua.mjs";

const { html } = processMarkdown({
  md: mdWithLua,   // Your markdown string with Lua code blocks
  langConfig: {
    langs: [langLua],  // Add custom Lua language grammar
    // aliases: {} can be added too if needed
  },
});

If this feature aligns with the direction of the project, I’d be happy to finalise the pull request. Let me know if you'd like any changes.

Thanks for considering!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions