Skip to content

v2.1.0

Latest
Compare
Choose a tag to compare
@LuudJanssen LuudJanssen released this 28 Oct 13:32
· 1 commit to main since this release

2.1.0 (2024-10-28)

Features

  • You can now customize the mapping of GitHub alert types to admonition directive names using the mapping option (#9):

    import { remark } from "remark";
    import remarkDirective from "remark-directive";
    import remarkGithubAdmonitionsToDirectives, {
      DEFAULT_MAPPING,
      DirectiveName,
      GithubAlertType,
      type AlertTypeMapping,
    } from "remark-github-admonitions-to-directives";
    
    const mapping: AlertTypeMapping = {
      ...DEFAULT_MAPPING,
      [GithubAlertType.IMPORTANT]: DirectiveName.WARNING,
    };
    
    const processor = remark()
      .use(remarkGithubAdmonitionsToDirectives, { mapping })
      .use(remarkDirective);
    
    const result = processor.processSync(`
    > [!IMPORTANT]
    > content
    `);
    
    console.log(result.toString());
    
    // should output:
    // :::info
    // content
    // :::