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] Add plain text component #1061

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

nadijagraca
Copy link
Contributor

Description

Added a new vm.Markdown model, allowing users to add plain text to their dashboard layout.

Screenshot

Notice

  • I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":

    • I submit this contribution under the Apache 2.0 license and represent that I am entitled to do so on behalf of myself, my employer, or relevant third parties, as applicable.
    • I certify that (a) this contribution is my original creation and / or (b) to the extent it is not my original creation, I am authorized to submit this contribution on behalf of the original creator(s) or their licensees.
    • I certify that the use of this contribution as authorized by the Apache 2.0 license does not violate the intellectual property rights of anyone else.
    • I have not referenced individuals, products or companies in any commits, directly or indirectly.
    • I have not added data or restricted code in any commits, directly or indirectly.

Copy link
Contributor

View the example dashboards of the current commit live on PyCafe ☕ 🚀

Updated on: 2025-03-11 13:34:04 UTC
Commit: ea2201e

Compare the examples using the commit's wheel file vs the latest released version:

vizro-core/examples/scratch_dev

View with commit's wheel vs View with latest release

vizro-core/examples/dev/

View with commit's wheel vs View with latest release

vizro-core/examples/visual-vocabulary/

View with commit's wheel vs View with latest release

vizro-core/examples/tutorial/

View with commit's wheel vs View with latest release

vizro-ai/examples/dashboard_ui/

View with commit's wheel vs View with latest release

@nadijagraca nadijagraca self-assigned this Mar 11, 2025
@nadijagraca nadijagraca requested a review from petar-qb March 11, 2025 13:49
Copy link
Contributor

@petar-qb petar-qb left a comment

Choose a reason for hiding this comment

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

Very clean! Congrats @nadijagraca 🚀

I have a few comments, but this PR looks great in general.

<!--
### Added

- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add an input here.

Comment on lines +61 to +72
("""# Header""", "# Header"),
("""_This **tests** emphasis_""", "_This **tests** emphasis_"),
("""> This tests blockquotes""", "> This tests blockquotes"),
("""* This tests list items""", "* This tests list items"),
("Text to test card", "Text to test card"),
("", ""),
(
"""![](assets/images/icons/content/hypotheses.svg)""",
"![](assets/images/icons/content/hypotheses.svg)",
),
("""Code block: ```python print(1)```""", "Code block: ```python print(1)```"),
("""[Example page](/test_page)""", "[Example page](/test_page)"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any difference between test_text and expected?

Copy link
Contributor

Choose a reason for hiding this comment

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

Good question. Ar we trying to test various situation where it might be altered but isn't?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this tests that Markdown does not modify the input string.

Copy link
Contributor

@maxschulz-COL maxschulz-COL left a comment

Choose a reason for hiding this comment

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

Nice and clean ⭐

Since this is such a small component, can we add the docs in the same PR?

from vizro.models._models_utils import _log_call


class Markdown(VizroBaseModel):
Copy link
Contributor

Choose a reason for hiding this comment

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

@antonymilne Do we really want to call the model Markdown? Wouldn't vm.Text be more declarative?

Comment on lines +61 to +72
("""# Header""", "# Header"),
("""_This **tests** emphasis_""", "_This **tests** emphasis_"),
("""> This tests blockquotes""", "> This tests blockquotes"),
("""* This tests list items""", "* This tests list items"),
("Text to test card", "Text to test card"),
("", ""),
(
"""![](assets/images/icons/content/hypotheses.svg)""",
"![](assets/images/icons/content/hypotheses.svg)",
),
("""Code block: ```python print(1)```""", "Code block: ```python print(1)```"),
("""[Example page](/test_page)""", "[Example page](/test_page)"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Good question. Ar we trying to test various situation where it might be altered but isn't?

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.

3 participants