-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch
Works by having a list of file extensions to render.
Fixes #236