Repository: eslint/eslint
File: docs/.eleventy.js (JavaScript)

Code before:
     * @returns {string} The markup for the alert.
     */
    function generateAlertMarkup(type, tokens, index) {
        if (tokens[index].nesting === 1) {
            return `
                <aside role="note" class="alert alert--${type}">
                    <svg class="alert__icon" aria-hidden="true" focusable="false" width="19" height="20" viewBox="0 0 19 20" fill="none">
                        <path d="M9.49999 6.66667V10M9.49999 13.3333H9.50832M17.8333 10C17.8333 14.6024 14.1024 18.3333 9.49999 18.3333C4.89762 18.3333 1.16666 14.6024 1.16666 10C1.16666 5.39763 4.89762 1.66667 9.49999 1.66667C14.1024 1.66667 17.8333 5.39763 17.8333 10Z" stroke="currentColor" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round" />
                    </svg>
                    <div class="alert__content">
                        <span class="alert__type">${type[0].toUpperCase()}${type.slice(1)}</span>
                        <div class="alert__text">
            `.trim();
        }

        return `
                        </div>
                    </div>
                </aside>
        `.trim();
    }

    const markdownIt = require("markdown-it");
    const md = markdownIt({ html: true, linkify: true, typographer: true, highlight: (str, lang) => highlighter(md, str, lang) })
        .use(markdownItAnchor, {
            slugify: slug
        })
        .use(markdownItContainer, "correct", {})
        .use(markdownItContainer, "incorrect", {})
        .use(markdownItContainer, "warning", {
            render(tokens, idx) {
                return generateAlertMarkup("warning", tokens, idx);
            }
        })
        .use(markdownItContainer, "tip", {
            render(tokens, idx) {
                return generateAlertMarkup("tip", tokens, idx);
            }
        })
        .use(markdownItContainer, "important", {
            render(tokens, idx) {
                return generateAlertMarkup("important", tokens, idx);
            }
        })
        .use(lineNumberPlugin)
        .disable("code");

    eleventyConfig.setLibrary("md", md);

    //------------------------------------------------------------------------------
    // Shortcodes

Review comment (suggestion):
```suggestion
            slugify: s => slug(s)
```

To ensure that the `slug` function is always passed one argument, because it [accepts two](https://github.com/Flet/github-slugger/blob/4bfc760a4702f0a4ea4c1d35dc6d1d865ca119a5/index.js#L44-L50).

Code after:
     * @returns {string} The markup for the alert.
     */
    function generateAlertMarkup(type, tokens, index) {
        if (tokens[index].nesting === 1) {
            return `
                <aside role="note" class="alert alert--${type}">
                    <svg class="alert__icon" aria-hidden="true" focusable="false" width="19" height="20" viewBox="0 0 19 20" fill="none">
                        <path d="M9.49999 6.66667V10M9.49999 13.3333H9.50832M17.8333 10C17.8333 14.6024 14.1024 18.3333 9.49999 18.3333C4.89762 18.3333 1.16666 14.6024 1.16666 10C1.16666 5.39763 4.89762 1.66667 9.49999 1.66667C14.1024 1.66667 17.8333 5.39763 17.8333 10Z" stroke="currentColor" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round" />
                    </svg>
                    <div class="alert__content">
                        <span class="alert__type">${type[0].toUpperCase()}${type.slice(1)}</span>
                        <div class="alert__text">
            `.trim();
        }

        return `
                        </div>
                    </div>
                </aside>
        `.trim();
    }

    const markdownIt = require("markdown-it");
    const md = markdownIt({ html: true, linkify: true, typographer: true, highlight: (str, lang) => highlighter(md, str, lang) })
        .use(markdownItAnchor, {
            slugify: s => slug(s)
        })
        .use(markdownItContainer, "correct", {})
        .use(markdownItContainer, "incorrect", {})
        .use(markdownItContainer, "warning", {
            render(tokens, idx) {
                return generateAlertMarkup("warning", tokens, idx);
            }
        })
        .use(markdownItContainer, "tip", {
            render(tokens, idx) {
                return generateAlertMarkup("tip", tokens, idx);
            }
        })
        .use(markdownItContainer, "important", {
            render(tokens, idx) {
                return generateAlertMarkup("important", tokens, idx);
            }
        })
        .use(lineNumberPlugin)
        .disable("code");

    eleventyConfig.setLibrary("md", md);

    //------------------------------------------------------------------------------
    // Shortcodes