Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML Editor Task #11

Open
AlexanderLill opened this issue Dec 3, 2024 · 0 comments
Open

HTML Editor Task #11

AlexanderLill opened this issue Dec 3, 2024 · 0 comments

Comments

@AlexanderLill
Copy link
Member

AlexanderLill commented Dec 3, 2024

Project

For this task, you will be working on a markdown editor called "Trix". "Trix" is a web application written in JavaScript and allows one to write and format text using simple styles such as bold, lists, and hyperlinks.

Setup

  1. Start the app in the terminal using the command npm run dev
  2. Navigate to the webpage http://localhost:8000 and reload once
  3. To stop the app, use CTRL+C within the terminal

Feature Request

Users have requested the functionality to download the content of the editor as a markdown file. The current download button (see red highlight) should be changed to convert the content to markdown before downloading. Please read the following text carefully to implement this task.

Screenshot 2024-12-03 at 10 31 40

While coding

👉 While working, search online for needed information. It is quicker than navigating through the entire codebase.
👉 Save the file to see the effects of your changes (no need to refresh the page in the browser).

Task Description

To implement this feature, two changes are necessary:

Change 1: Implement markdown conversion

  • ToDo: Change the label of the "Download (HTML)" button to "Download (Markdown)" and adjust the functionality accordingly to convert the HTML to markdown before download (see src/trix/config/toolbar.js)
    • Note: Please use the already imported library turndown for converting the HTML document content to a markdown format
  • Test: You are done when clicking the "Download (Markdown)" button downloads a markdown file with markdown content. Here is an example:
ExampleExpected Output
trix-example
This is a heading
======

Some normal text

  • Bullet point 1
  • Bullet point 2

Change 2: Modify the format of the downloaded markdown

  • ToDo: The downloaded markdown file should look more similar to the commonly used GitHub markdown flavour. For this, please modify the turndown configuration to accomplish the following format:
      1. Change the headline style from using equal signs (======) to put a single hashtag in front of the h1 headline (atx-style) , e.g., # H1 Heading.
      1. Change the style for code blocks from using indentation (e.g. by 4 spaces) to a fenced style (having ``` above and below a code block).
  • Test: You are done when the export of the given example looks like in the example below:
    Here is an example:
ExampleExpected Output
Screenshot 2024-12-03 at 10 25 55
# This is a heading

Some normal text

```
if (true) {
console.log("It's true!")
} else {
console.log("It's false!")
}
```

@AlexanderLill AlexanderLill changed the title HTML Editor: Adding markdown download HTML Editor Task Dec 13, 2024
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

No branches or pull requests

1 participant