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

feat: Improve markdown typography #2179 #2189

Merged
merged 20 commits into from Nov 16, 2023
Merged

feat: Improve markdown typography #2179 #2189

merged 20 commits into from Nov 16, 2023

Conversation

marek-mihok
Copy link
Contributor

@marek-mihok marek-mihok commented Nov 8, 2023

The PR fulfills these requirements: (check all the apply)

  • It's submitted to the main branch.
  • When resolving a specific issue, it's referenced in the PR's title (e.g. feat: Add a button #xxx, where "xxx" is the issue number).
  • When resolving a specific issue, the PR description includes Closes #xxx, where "xxx" is the issue number.
  • If changes were made to ui folder, unit tests (make test) still pass.
  • New/updated tests are included

This change allows using compact=False attribute to toggle on a modern, well-structured and reader-friendly markdown look!

Screen.Recording.2023-11-14.at.10.32.24.mov

Updated API is as follows:

/**
 * Create a card that renders Markdown content.
 *
 * Github-flavored markdown is supported.
 * HTML markup is allowed in markdown content.
 * URLs, if found, are displayed as hyperlinks.
 * Copyright, reserved, trademark, quotes, etc. are replaced with language-neutral symbols.
 * :icon "InsertTextBox"
 */
interface State {
  /**
   * The title for this card.
   * :t "textbox"
   * :value "Untitled Content"
   **/
  title: S
  /**
   * The markdown content. Supports Github Flavored Markdown (GFM): https://guides.github.com/features/mastering-markdown/
   * :t "textarea"
   * :value "Hello, World!"
   **/
  content: S
  /**
   * Additional data for the card.
   **/
  data?: Rec
  /**
 * In compact mode markdown content takes less screen space. Defaults to True.
 **/
  compact?: B
}

In addition, this PR fixes an issue where there was a conflict when using multiple markdown cards on the same page.

Closes #2179

@mturoci
Copy link
Collaborator

mturoci commented Nov 8, 2023

@marek-mihok there is no need to add the whole Tailwind. The issue talks about adding only styles from https://tailwindcss.com/docs/typography-plugin.

@marek-mihok marek-mihok marked this pull request as ready for review November 9, 2023 14:08
Copy link
Collaborator

@mturoci mturoci left a comment

Choose a reason for hiding this comment

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

Thanks @marek-mihok!

  • Can you please add an example with all the markdown elements for a side by side comparison?
  • Seems like the new styles are pretty spacious. Let's add compact attribute defaulting to true to toggle this behavior.
  • Can the added CSS be loaded dynamically (only when markdown card is actually used)?

ui/src/markdown.css Outdated Show resolved Hide resolved
ui/src/markdown.css Outdated Show resolved Hide resolved
ui/src/markdown.css Outdated Show resolved Hide resolved
@marek-mihok
Copy link
Contributor Author

  • Can you please add an example with all the markdown elements for a side by side comparison?

I've updated the existing example with side by side comparison. Please let me know if it is fine.

  • Seems like the new styles are pretty spacious. Let's add compact attribute defaulting to true to toggle this behavior.

Done ✅

  • Can the added CSS be loaded dynamically (only when markdown card is actually used)?

Done ✅

@mturoci since this is a visual change, do we need tests checking if proper styling is applied when compact=False?

Copy link
Collaborator

@mturoci mturoci left a comment

Choose a reason for hiding this comment

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

Thanks @marek-mihok.

since this is a visual change, do we need tests checking if proper styling is applied when compact=False?

You already added one in markdown.md#compact.

ui/jest.config.js Outdated Show resolved Hide resolved
ui/jest.config.js Outdated Show resolved Hide resolved
ui/src/markdown.tsx Show resolved Hide resolved
ui/src/markdown.tsx Show resolved Hide resolved
ui/src/markdown.tsx Outdated Show resolved Hide resolved
@mturoci mturoci merged commit a321fc9 into main Nov 16, 2023
2 checks passed
@mturoci mturoci deleted the feat/issue-2179 branch November 16, 2023 10:26
marek-mihok added a commit that referenced this pull request Jan 15, 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

Successfully merging this pull request may close these issues.

Improve markdown typography via nicer defaults
2 participants