Skip to content

Conversation

@Aditya-githubbb
Copy link
Contributor

Built a form to allow users to submit new coding challenges, including the following fields:
1] Challenge Title
2] Description (supports basic Markdown formatting and shows a live preview)
3] Difficulty Level (Easy, Medium, Hard)
4] Test Cases (entered in JSON format)

Features included:

✅ Field validation for required inputs

✅ JSON format checking for test cases

✅ Real-time preview for the description section

✅ Fully implemented using plain HTML, CSS, and JavaScript

@adityai0 adityai0 requested a review from Copilot July 21, 2025 16:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a complete challenge creation form to enable users to submit new coding challenges with validation and markdown preview functionality. The implementation includes form validation, JSON format checking for test cases, and real-time markdown preview for descriptions.

Key changes:

  • Added a comprehensive form with all required fields for challenge creation
  • Implemented client-side validation and markdown-to-HTML conversion
  • Added CSS styling for improved user experience

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
scripts/app.js Implements form validation, markdown preview functionality, and form submission handling
index.html Adds the challenge creation form structure with embedded CSS styling
Comments suppressed due to low confidence (1)

scripts/app.js:28

  • The solution field is collected but not validated. Consider adding validation to ensure the solution field is not empty since it's marked as required in the HTML.
    solution: document.getElementById('solution').value.trim()

.replace(/\*(.*?)\*/gim, '<i>$1</i>')
.replace(/\n$/gim, '<br />');

preview.innerHTML = formatted;
Copy link

Copilot AI Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directly setting innerHTML with user input creates an XSS vulnerability. Use textContent or a proper sanitization library to prevent script injection attacks.

Copilot uses AI. Check for mistakes.
@adityai0
Copy link
Member

@Aditya-githubbb provide screenshot and video of work and resolve merge conflicts.

@Aditya-githubbb
Copy link
Contributor Author

resolved merge conflicts @adityai0

@Aditya-githubbb
Copy link
Contributor Author

Screenshot 2025-07-22 at 5 15 21 PM

@Aditya-githubbb
Copy link
Contributor Author

@adityai0 adityai0 merged commit 1789666 into opensource-society:main Jul 22, 2025
1 check failed
@adityai0
Copy link
Member

which issue it closes? @Aditya-githubbb

@Aditya-githubbb
Copy link
Contributor Author

@adityai0 issue no #21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants