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

Support factors in fmt_markdown() with HTML output #1883

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

rossellhayes
Copy link
Contributor

Summary

This PR closes #1882 by ensuring factors are converted to text before converting to markdown when fmt_markdown() is used with HTML output. It achieves this by adding text <- as.character(text) as the first step in the md() function. It also adds a test of rendering a factor column with markdown formatting and updates the NEWS file.

gt(data.frame(x = factor("TEST"))) |> 
  fmt_markdown()
x
TEST

Created on 2024-09-17 with reprex v2.1.0

Related GitHub Issues and PRs

Checklist

Copy link
Member

@rich-iannone rich-iannone left a comment

Choose a reason for hiding this comment

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

This is great, thanks!

@rich-iannone rich-iannone merged commit b4fa1b3 into rstudio:master Sep 18, 2024
12 checks passed
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.

Using fmt_markdown() on a factor prints the numeric factor level when the output format is HTML
2 participants