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

Add basic support for rendering code and other preformatted text #240

Merged
merged 1 commit into from
Oct 24, 2023

Conversation

bloodearnest
Copy link
Collaborator

@bloodearnest bloodearnest commented Oct 18, 2023

Works by having a list of file extensions to render.

Fixes #236

@bloodearnest bloodearnest marked this pull request as ready for review October 18, 2023 13:13
Works by having a list of file extensions to render.
@@ -11,13 +11,14 @@ export const isCsv = (ext) => ext.toLowerCase() === "csv";
export const isImg = (ext) =>
["gif", "jpg", "jpeg", "png", "svg"].includes(ext.toLowerCase());

export const TEXT_TYPES = ["txt", "md", "py", "yaml", "R", "log"];
/**
* Confirm if file is .txt
* @param {string} ext - file extension
* @returns {boolean}
*/
export function isTxt(ext) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd be tempted to rename the function as isText to make it clearer that it's not just checking for a .txt extension.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good idea, will do

@@ -11,13 +11,14 @@ export const isCsv = (ext) => ext.toLowerCase() === "csv";
export const isImg = (ext) =>
["gif", "jpg", "jpeg", "png", "svg"].includes(ext.toLowerCase());

export const TEXT_TYPES = ["txt", "md", "py", "yaml", "R", "log"];
/**
* Confirm if file is .txt
Copy link
Contributor

Choose a reason for hiding this comment

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

This code comment is now out of date, as it's no longer just checking for ".txt"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch

@bloodearnest bloodearnest merged commit 28b27d7 into main Oct 24, 2023
5 checks passed
@bloodearnest bloodearnest deleted the code branch October 24, 2023 10:53
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.

"Code" type outputs, with syntax highlighting
2 participants