-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Fix the import of external md files #3472
Conversation
Quick question: was I not supposed to commit the Edit: was adding a snap test in this case even necessary? |
You were |
@Hypnosphi, is there a reason the codecov report is not triggering? |
IDK, but it's no big problem |
BTW, I'm OK with replacing md-loader + html-loader with raw-loader, this looks like the easiest possible solution. It would be a breaking change, but we're going to release a new major version anyway The corresponding files are And the same for other frameworks |
5a1a027
to
9740215
Compare
Codecov Report
@@ Coverage Diff @@
## master #3472 +/- ##
==========================================
+ Coverage 37.56% 92.5% +54.93%
==========================================
Files 458 6 -452
Lines 10350 40 -10310
Branches 919 2 -917
==========================================
- Hits 3888 37 -3851
+ Misses 5889 2 -5887
+ Partials 573 1 -572 Continue to review full report at Codecov.
|
The tip of my local branch was behind on remote. Fixing it the way git tells me causes merge conflicts on code from one of the older commits (removed in later commit), so I decided to force push over it. |
Looks like notes addon relies on old imports: The easiest fix is to replace |
This part of docs needs update as well: https://github.com/storybooks/storybook/blob/master/docs/src/pages/basics/writing-stories/index.md#using-markdown |
Will update the according documentation! Regarding the notes addon, @Hypnosphi: While I see it in your link, I can't seem to reproduce it on my current |
What happens if you make a static build using |
@Hypnosphi I have to run it from |
Yes. You can open |
So the markdown in the notes of https://github.com/storybooks/storybook/blob/851211019d2858a86c9bda2dde46919e36efa53d/examples/official-storybook/stories/addon-notes.stories.js#L35 actually works as intended (just like my previous schreenshot). But, the story I added with an external md file does not. Did I mess up somewhere in the configs @Hypnosphi ? |
That's weird, it works OK in deployed version Is there a chance that you didn't run |
Oh yes, now I reproduced it. I probably messed up something with the dependencies.. Will look into the notes addon and update the docs soon! |
Applied the requested changes @Hypnosphi |
addons/notes/README.md
Outdated
); | ||
``` | ||
|
||
If you want to use Github flavored markdown inline, use `notes: { markdownText: 'your md' }`: | ||
Similarly, if you want to use Github flavored markdown inline, use `notes: { markdownText: 'your md' }`: |
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.
Looks like markdownText
part is a typo in current docs, the example below uses markdown
Also, after your change there's no difference in handling inline vs imported markdown, so you can just remove this paragraph
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.
Combined the text for both examples and removed the 2nd paragraph. Please let me know if you think the description needs to be adjusted!
Please update storyshot:
|
Done! |
Issue: Fixes #3458. Right now, if markdown is imported from an external file, the content will be displayed as HTML. Different combinations of markdown elements would lead to different combinations of HTML and semi-proper markdown (styling was off). As far as I'm aware of from playing around with it, this is caused by auto conversion to HTML when importing the
.md
file.What I did
There were three options that I found that could work:
I didn't have experience with webpack and the second option ignored all the styling from existing components. So I implemented the last option with turndown. The condition for actually running the conversion is a regex checks on an HTML element at the start of the string. The option for the start was deliberate in order not to mess with markdown containing code examples.
How to test