Comments (10)
They're still .js
files as far as I can tell 🤔
from styled-components-website.
I think this: https://www.npmjs.com/package/markdown-loader
Could be okay , it transforms stuff into html and then we can just import it on the page
from styled-components-website.
We can't just transform it to HTML though since we have React components in our markdown, that's why we use react-markings
.
I think what we'd rather do is use wrapper-webpack-plugin
to wrap each .md
file with this boilerplate:
import md from 'components/md'
export default () => md`
${MARKDOWN_CONTENT}
`
What I'm unsure about after that is how we get webpack to treat these files as JavaScript, what they are at that point. 🤔
from styled-components-website.
But doing that would still have the problem with the escaping :(
from styled-components-website.
@kentcdodds has posted me a link to their loader on Twitter, which does what you're talking about. https://twitter.com/kentcdodds/status/902262231374716928
The problem with going down this route is that we also lose interpolations. Those are important to have some flexibility to what we can render: https://github.com/styled-components/styled-components-website/blob/master/sections/basics/motivation.js
We could also just try to find a different set of characters for code blocks? Albeit that being a bit clunky as well, I know 😆
from styled-components-website.
Also linked in that tweet thread: Custom markdown syntax for interpolations and the implementation.
I've considered making this a pluggable standalone project to clean up the implementation a bit. It's actually pretty great 😄
I think the core piece you want with next.js is a solution that works at the babel level rather than the webpack level. It'll make everything much snappier, especially with SSR and static extract. So you may also consider a simpler approach using something like babel-plugin-preval
. Which would require a little more boilerplate, but would be pretty simple.
Good luck friends! Feel free to ping me if you need me for anything (I'm going to unsubscribe). I'm happy to help! 😄
from styled-components-website.
Guys! Isn't this already done?
from styled-components-website.
Mhmm, I'll check it out and paste a list here for easy changing
from styled-components-website.
I just found reactdown by @andreypopp which looks perfect for our purpose? https://www.npmjs.com/package/reactdown (he wrote that four years ago...) It's basically what we're using right now BUT let's your write your stuff as external .md files.
Also found https://github.com/mapbox/jsxtreme-markdown, which is similar but looks a bit more like a templating language, and https://github.com/cerebral/marksy#custom-components which seems similar to reactdown?
from styled-components-website.
This has been fixed by @mxstbr . We now use .md|.mdx
files.
from styled-components-website.
Related Issues (20)
- Add FAQ on NextJS 13 usage HOT 2
- Add [project] by [company] to showcase HOT 1
- Need a FAQ page added for this HOT 3
- Add [project] by [company] to showcase
- Add [project] by [company] to showcase
- Wrong Link in the docs for v6 migration
- Add [project] by [company] to showcase
- Add [project] by [company] to showcase
- Add [project] by [company] to showcase
- Add [project] by [company] to showcase
- Add [project] by [company] to showcase
- Add [project] by [company] to showcase
- On the homepage live edit example, the cursor is off by 1 character HOT 1
- Add [project] by [company] to showcase
- Add [project] by [company] to showcase
- Add [project] by [company] to showcase ok
- Inaccurate `shouldForwardProp` description
- Add dark theme to documentation HOT 2
- Add [https://themeselection.com/] by [Clevision] to showcase
- Add [https://themeselection.com/] by [Clevision] to showcase HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from styled-components-website.