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

General: Add support for markdown callouts #10158

Merged
merged 6 commits into from
Jan 17, 2025
Merged

Conversation

tobias-lippert
Copy link
Contributor

@tobias-lippert tobias-lippert commented Jan 16, 2025

Checklist

General

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data (e.g. using paging).
  • I strictly followed the client coding and design guidelines.
  • Following the theming guidelines, I specified colors only in the theming variable files and checked that the changes look consistent in both the light and the dark theme.
  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes.

Motivation and Context

Callouts are an extension of standard markdown that allow to highlight certain words/sentences in markdown text with a box and a visual indicator.
This helps to emphasize important parts of the text.
GitHub is the most prominent platform that supports them.

Closes #10116

Description

Added the markdown-it-github-alerts plugin to the extensions of markdown it (the client library we use to render markdown) and imported the necessary css files, so the callouts are displayed with the correct colors.

Steps for Testing

Prerequisites:

  • 1 Instructor
  1. Log in to Artemis
  2. Navigate to Course Administration
  3. Go to a markdown editor of your choice, e.g. when creating an exercise
  4. Enter the following text

Note

Highlights information that users should take into account, even when skimming.

Some other text

Tip

Optional information to help a user be more successful.

Important

Crucial information necessary for users to succeed.

Warning

Critical content demanding immediate user attention due to potential risks.

Caution

Negative potential consequences of an action.

  1. Make sure it's rendered properly in the preview and once it's saved.
  2. Check the readability in both light and dark mode.
  3. Also check the student view that it's correctly rendered

Exam Mode Testing

Components in the exam mode are the same as in the course view.

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.







Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

Unchanged

Screenshots

Student view
image

Instructor view
image

Summary by CodeRabbit

  • New Features

    • Added support for GitHub-style markdown alerts and callouts
    • Enhanced markdown rendering with new styling options
  • Dependencies

    • Introduced markdown-it-github-alerts library to improve markdown functionality
    • Added new SCSS imports for GitHub alert styles

@tobias-lippert tobias-lippert requested a review from a team as a code owner January 16, 2025 19:47
@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Jan 16, 2025
Copy link

coderabbitai bot commented Jan 16, 2025

Walkthrough

This pull request introduces support for GitHub-style markdown callouts by adding the markdown-it-github-alerts library. The changes involve adding a new dependency in package.json, updating the markdown conversion utility to include the new extension, and importing corresponding CSS styles in the global stylesheet. The implementation enables rendering of special markdown alert blocks with different semantic levels like NOTE, TIP, IMPORTANT, WARNING, and CAUTION.

Changes

File Change Summary
package.json Added dependency "markdown-it-github-alerts": "0.3.0"
src/main/webapp/app/shared/util/markdown.conversion.util.ts Imported MarkdownItGitHubAlerts and added to markdown extensions
src/main/webapp/content/scss/global.scss Added CSS imports for GitHub alerts styles (light, dark, base)

Assessment against linked issues

Objective Addressed Explanation
Support Markdown Callouts
Render GitHub-style Alert Blocks

Possibly related PRs

Suggested labels

small, bugfix, tests, lock:artemis-test2

Suggested reviewers

  • SimonEntholzer
  • BBesrour
  • Feras797
  • krusche
  • LeonWehrhahn

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between feda9b8 and 371bcd9.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: server-tests
  • GitHub Check: server-style
  • GitHub Check: client-tests-selected
  • GitHub Check: client-style
  • GitHub Check: client-tests
  • GitHub Check: Build and Push Docker Image
  • GitHub Check: Build .war artifact
  • GitHub Check: Analyse
  • GitHub Check: Mend Security Check

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 16, 2025
@tobias-lippert tobias-lippert marked this pull request as draft January 16, 2025 19:54
@tobias-lippert tobias-lippert marked this pull request as ready for review January 16, 2025 20:05
@vinceclifford vinceclifford temporarily deployed to artemis-test5.artemis.cit.tum.de January 16, 2025 20:54 — with GitHub Actions Inactive
vinceclifford
vinceclifford previously approved these changes Jan 16, 2025
Copy link

@vinceclifford vinceclifford left a comment

Choose a reason for hiding this comment

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

Tested on TS5, works as expected.

kevinfischer4
kevinfischer4 previously approved these changes Jan 17, 2025
Copy link

@kevinfischer4 kevinfischer4 left a comment

Choose a reason for hiding this comment

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

Tested on TS5. Works as expected in the different (pre-)views.
image

HawKhiem
HawKhiem previously approved these changes Jan 17, 2025
Copy link

@HawKhiem HawKhiem left a comment

Choose a reason for hiding this comment

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

Tested on TS5. Works as described

package.json Outdated Show resolved Hide resolved
Copy link
Contributor

@b-fein b-fein left a comment

Choose a reason for hiding this comment

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

Code 👍

(I don’t think exam mode test is needed since the markdown component is the same everywhere.)

Copy link

@vinceclifford vinceclifford left a comment

Choose a reason for hiding this comment

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

Reapprove

@sawys777 sawys777 temporarily deployed to artemis-test1.artemis.cit.tum.de January 17, 2025 12:07 — with GitHub Actions Inactive
Copy link

@sachmii sachmii left a comment

Choose a reason for hiding this comment

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

Tested on TS1, works as expected.

image

Copy link

@sawys777 sawys777 left a comment

Choose a reason for hiding this comment

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

Tested on TS1, everything works as expected

Copy link
Contributor

@Strohgelaender Strohgelaender left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Member

@krusche krusche left a comment

Choose a reason for hiding this comment

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

super cool 👍

@krusche krusche added this to the 7.9.0 milestone Jan 17, 2025
@krusche krusche merged commit e4fcadf into develop Jan 17, 2025
33 of 37 checks passed
@krusche krusche deleted the feature/markdown-callouts branch January 17, 2025 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Pull requests that update TypeScript code. (Added Automatically!) ready to merge
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

Support for Markdown Callouts in Exercise Description
9 participants