Have ideas to improve npm?Join in the discussion! »

    markdown-magic-prettier

    1.0.4 • Public • Published

    markdown-magic-prettier

    Use prettier to format JS codeblocks in markdown files via markdown-magic

    Install

    yarn add -D markdown-magic markdown-magic-prettier prettier
    

    Note: prettier is a peer dependency and must be installed separately from this module

    Adding the plugin

    See example.js for usage.

    const fs = require('fs');
    const path = require('path');
    const markdownMagic = require('markdown-magic');
     
    const config = {
      transforms: {
        PRETTIER: require('./index.js'),
      },
    };
     
    const markdownPath = path.join(__dirname, 'README.md');
    markdownMagic(markdownPath, config);

    Usage in markdown

    Wrap code blocks to format the content.

    console.log('hello world');

    Options

    All prettier options are supported.

    There are a few defaults set:

    const defaults = {
      singleQuote: true,
      trailingComma: 'es5',
    };

    Install

    npm i markdown-magic-prettier

    DownloadsWeekly Downloads

    9

    Version

    1.0.4

    License

    MIT

    Last publish

    Collaborators

    • avatar