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.

Activity

added 2 commits that reference this issue on Feb 18, 2025
dcf8329
687e2bb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @thesamet

        Issue actions

          Extract example inputs for puzzle markdown · Issue #81 · fspoettel/advent-of-code-rust