Skip to content

Extract example inputs for puzzle markdown #81

Open
@thesamet

Description

@thesamet

When solving Advent of Code puzzles, a common repetitive task is manually copying example inputs from the puzzle's markdown file and saving them in the data/examples directory. This process can be tedious and error-prone.

Proposed Solution

Introduce a command that scans the puzzle text for example inputs and writes them to files in data/examples.

Detection Method:

Example inputs are always presented as code blocks (enclosed within triple backticks ```).
In case of multiple code blocks, some may contain outputs, diagrams, or other non-input content. To handle this, the command can prompt the user interactively to confirm which blocks should be saved.

Naming Convention:

If only one input is accepted, it should be saved as ${day}.txt.
If multiple inputs are extracted, they should be named ${day}-{part}.txt.

Expected Workflow

  • Run the command (e.g., cargo extract ${day}).
  • The tool scans the puzzle markdown file for code blocks.
  • If multiple blocks are found, the user is prompted to confirm which ones should be saved.
  • Selected example inputs are saved with appropriate filenames.

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