or run

tessl search
Log in

Version

Files

tile.json

task.mdevals/scenario-8/

Footnote Customization System

Create a footnote rendering system that transforms Markdown with footnotes into customized HTML output with language-specific labels.

Requirements

Your system should:

  1. Accept Markdown content containing footnotes (the [^1] syntax)
  2. Transform the footnotes with customizable labels and back-reference text
  3. Configure the ID prefix used to prevent collisions when multiple documents are rendered on the same page
  4. Return the compiled JavaScript code as a string

Implement a function compileWithFootnotes(markdown, options) that:

  • Takes a Markdown string as the first parameter
  • Takes an options object as the second parameter with:
    • footnoteLabel (string): The label shown before the footnotes section
    • footnoteBackLabel (string): The accessible label for back-to-reference links
    • clobberPrefix (string): The prefix for IDs to avoid collisions
  • Returns the compiled JavaScript code as a string (extract the value property from the compilation result)

Test Cases

  • Given Markdown with a footnote reference [^1] and definition [^1]: First note, compiling with default options produces JavaScript output @test

  • Given Markdown with multiple footnotes, compiling with footnoteLabel: "Notes" produces output where the footnotes section uses "Notes" as the heading @test

  • Given Markdown with footnotes, compiling with clobberPrefix: "doc-" produces output with IDs prefixed with "doc-" @test

Implementation

@generates

API

/**
 * Compiles Markdown with footnotes using custom configuration
 * @param {string} markdown - The Markdown source with footnotes
 * @param {Object} options - Configuration options
 * @param {string} options.footnoteLabel - Label for the footnotes section
 * @param {string} options.footnoteBackLabel - Accessible label for back-references
 * @param {string} options.clobberPrefix - ID prefix to prevent collisions
 * @returns {Promise<string>} The compiled JavaScript code
 */
export async function compileWithFootnotes(markdown, options) {
  // Implementation
}

Dependencies { .dependencies }

@mdx-js/mdx { .dependency }

Provides MDX compilation capabilities with configurable markdown-to-HTML transformation.

remark-gfm { .dependency }

Provides GitHub Flavored Markdown support including footnote syntax.