-
Notifications
You must be signed in to change notification settings - Fork 16
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
markdown preview #818
markdown preview #818
Conversation
…nto feat/text-file-previewer-802
Your Render PR Server URL is https://chainsafex-dev-pr-818.onrender.com. Follow its progress at https://dashboard.render.com/static/srv-c15pgs5c2rvrn4r8mnmg. |
Your Render PR Server URL is https://files-ui-dev-pr-818.onrender.com. Follow its progress at https://dashboard.render.com/static/srv-c15pgt5c2rvrn4r8mntg. |
Your Render PR Server URL is https://files-landing-dev-pr-818.onrender.com. Follow its progress at https://dashboard.render.com/static/srv-c15pgudc2rvrn4r8molg. |
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.
Great work, thanks Tanmoy 🎉
@tanmoyAtb there doens't seem to be any markdown styling applied, besides the H1 (#) tags: # Test
## Testing
### Raspberry souffle
### Ingredients
#### For the Raspberry Puree:
- 12 ounces frozen raspberries, thawed
#### For the Soufflé:
- 4 egg yolks
- 2 1/2 ounces granulated sugar
- 1.5 tablespoons cornstarch
- 4 ounces raspberry puree (see above)
- juice of one lemon
- 4 egg whites, room temperature
- pinch of cream of tartar
- pinch of salt
- 1 ounce granulated sugar
- powdered sugar, for dusting
- fresh raspberries, for garnish
|
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.
const classes = useStyles() | ||
|
||
useEffect(() => { | ||
const getContentText = async () => { |
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.
Just a comment to share my thoughts, it's no big deal, but I've seen this form used widely across Files.
I think we should rather use the Promise.then in a hook, and handle errors accordingly (if this fails, we'll throw the app with an unhandeld exception). Async/await makes a lot of sense if we have many such async calls. It should then be wrapped in try/catch which makes it pretty verbose.
For instance here I'd suggest:
contents.text()
.then((text) => setContentText(text))
.catch(console.error)
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.
Agree that the .then(...).catch(...)
is quite a bit more concise for simple handlers like this.
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.
updated to then catch in both text and markdown preview !
…afe/files-ui into feat/markdown-preview-795
The code blocks are working on my side This is the md text
|
… feat/markdown-preview-795
…afe/files-ui into feat/markdown-preview-795
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.
The code is indeed in a <code>
block. The font for me is font-family: monospace, monospace;
which basically looks like the text font. Having no background color also reinforces the feeling. In any case it's not really a bug, we can make this better if the need appears.
closes #795
There are many plugins that could bee used with markdowns! However this minimalistic approach should be good enough for previews !