Markdown component for React
remarkjs/remark 3687
Markdown processor powered by plugins part of the @unifiedjs collective
plugin to compile Markdown to HTML
Curated list of awesome remark resources
remarkjs/remark-frontmatter 88
plugin to support frontmatter (YAML, TOML, and more)
plugin to autolink references to commits, issues, pull-requests, and users, like on GitHub
remarkjs/remark-highlight.js 51
plugin to highlight code blocks with highlight.js (via lowlight)
remarkjs/remark-autolink-headings 46
plugin to automatically add links to headings
remarkjs/remark-external-links 38
plugin to automatically add target and rel attributes to external links
remark plugin to support GFM (autolink literals, strikethrough, tables, tasklists)
issue commentremarkjs/react-remark
Server rendering/setting initial markdown state
Taking a step back from the problem, from a moment, it sounds like you're looking more for a pure static content generator? Would going from markdown to javascript, and saving/running an ahead of time generated component work in your use case? Something along the lines of: https://mdxjs.com/advanced/api (built on remark)
Unfortunately not as the content is stored in a headless CMS. Currently it handles blog posts in markdown, but we are in the process of extending it out to handle custom pages as well (which may contain JSX and/or HTML), which will be handled by a content team and occasional developer for more complicated markup/layouts.
comment created time in 2 hours
startedremarkjs/remark
started time in 3 hours
issue commentremarkjs/ideas
My current client's legacy docs (which I need to keep support for) use this pattern:
_Caption text_
comment created time in 5 hours
startedremarkjs/react-markdown
started time in 5 hours
startedremarkjs/remark
started time in 5 hours
startedremarkjs/remark-html
started time in 5 hours
issue commentremarkjs/react-remark
Server rendering/setting initial markdown state
https://codesandbox.io/s/objective-montalcini-cixpt this is the equivalent of:
function InfiniteLoop () {
const [state, setState] = useState();
setState({});
return null;
}
each render setState
is called, setState
triggers a render, repeat ad infinitum.
a useEffect
can be used to call set just once https://codesandbox.io/s/stoic-snow-4846x
We are server rendering in .NET Core via ReactJS.NET in a polyfilled Chakra core runtime on the server
Oof, isomorphic react on a non-V8 runtime, with lightly supported language bindings, that doesn't sound fun, sorry.
Perhaps a solution is to have an option to use
processSync
withprocess
as the default? e.g a synchronous or async boolean option passed touseRemark
hook?
It is an option :thinking: And maybe one that could make sense.
Taking a step back from the problem, from a moment, it sounds like you're looking more for a pure static content generator? Would going from markdown to javascript, and saving/running an ahead of time generated component work in your use case? Something along the lines of: https://mdxjs.com/advanced/api (built on remark)
comment created time in 13 hours
startedremarkjs/remark
started time in 13 hours
startedremarkjs/remark
started time in 13 hours
startedremarkjs/remark-gfm
started time in 14 hours
startedremarkjs/react-markdown
started time in 14 hours
startedremarkjs/remark
started time in 15 hours
startedremarkjs/remark-slug
started time in 16 hours
push eventremarkjs/react-markdown
commit sha e0b3691393f7d85cf55eeb876fc23ed41657db10
Deploy remarkjs/react-markdown to github.com/remarkjs/react-markdown.git:gh-pages
push time in 18 hours
startedremarkjs/remark-footnotes
started time in 19 hours
startedremarkjs/remark
started time in 19 hours
startedremarkjs/remark-react
started time in 19 hours
startedremarkjs/react-markdown
started time in 21 hours
startedremarkjs/remark
started time in a day
issue commentremarkjs/react-markdown
Tables are not rendered correctly for readme
This project does not concern itself with styling. You can use things like CSS to style the results!
Thanks @wooorm for your help :hugs:
comment created time in a day
issue commentremarkjs/react-remark
Server rendering/setting initial markdown state
Server rendering react-remark components by passing through an initial state value to useRemark
What are you using for serverside rendering? A framework like Gatsby or Next? Something else?
We are server rendering in .NET Core via ReactJS.NET
Have tried using the first example in README.md, which creates an infinite loop
Could you share a runnable example of this? for example in https://codesandbox.io
Below example that crashes:
https://codesandbox.io/s/objective-montalcini-cixpt?
setMarkdownSource uses unified.process which is async
Could you expand why this is an problem? Next, for example, supports async processes in SSR via
getStaticProps
https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation Another consideration here,remark
andrehype
plugins can be async, and async plugins can only be used withprocess
, I'd like to avoid the usage ofprocessSync
if possible to avoid restrictions on what plugins work.
We are using base react in a polyfilled Chakra core runtime on the server. AFAIK there is no way in base react to set an initial state via async in useState constructor (calling setState in a useEffect is not an option as that does not get run in react-dom/server's renderToString method). Perhaps a solution is to have an option to use processSync with process as the default? e.g a synchronous
or async
boolean option passed to useRemark hook? However we would still need a way to set the initial content state so react-dom/server can render it's contents.
comment created time in a day
startedremarkjs/remark-html
started time in a day
startedremarkjs/remark
started time in a day
startedremarkjs/react-markdown
started time in a day
startedremarkjs/react-markdown
started time in a day
issue commentremarkjs/remark-react
To add on, remark-react
builds on and surfaces options from: https://github.com/syntax-tree/mdast-util-to-hast, https://github.com/syntax-tree/hast-util-sanitize, and https://github.com/syntax-tree/hast-to-hyperscript each of which have typings that can be imported/leveraged here.
comment created time in 2 days
push eventremarkjs/react-markdown
commit sha 14c707e7c82b745e2355c2416c85019bfbac58f0
Deploy remarkjs/react-markdown to github.com/remarkjs/react-markdown.git:gh-pages
push time in 2 days
push eventremarkjs/react-markdown
commit sha c5d51fef7058389b16e0efa63e76ebcc7b6a48a9
Fix typo Closes GH-534. Reviewed-by: Titus Wormer <tituswormer@gmail.com>
push time in 2 days
PR merged remarkjs/react-markdown
<!-- Read the contributing guidelines.
We are excited about pull requests, but please try to limit the scope, provide a general description of the changes, and remember, it's up to you to convince us to land it.
If this fixes an open issue, link to it in the following way: Closes GH-123
.
New features and bug fixes should come with tests.
P.S. have you seen our support and contributing docs? https://github.com/remarkjs/.github/blob/main/support.md https://github.com/remarkjs/.github/blob/main/contributing.md -->
pr closed time in 2 days