Skip to content

[WIP] Next Major Release - #39

Draft
ChristianMurphy wants to merge 2 commits into
mainfrom
version-2
Draft

[WIP] Next Major Release#39
ChristianMurphy wants to merge 2 commits into
mainfrom
version-2

Conversation

@ChristianMurphy

@ChristianMurphyChristianMurphy commented Aug 26, 2021

Copy link
Copy Markdown
Member

drop tsdx in favor of custom build, due to lack of TS4 and limited ESM
support

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and couldn’t find anything (or linked relevant results below)
  • If applicable, I’ve added docs and tests

Description of changes

@ChristianMurphyChristianMurphy added ☂️ area/types This affects typings 🏗 area/tools This affects tooling 📚 area/docs This affects documentation 📦 area/deps This affects dependencies 🕸️ area/tests This affects tests 🗄 area/interface This affects the public interface 🧑 semver/major This is a change 🛠 blocked/wip This cannot progress yet, it’s being worked on labels Aug 26, 2021
Comment threadtsconfig.json
@ChristianMurphyChristianMurphy mentioned this pull request Jan 19, 2022
4 tasks
@ChristianMurphyChristianMurphy mentioned this pull request May 11, 2022
4 tasks
@mrienstramrienstra mentioned this pull request Jul 28, 2023
4 tasks
@karlhorky

Copy link
Copy Markdown

@ChristianMurphy would it be possible to get an alpha/canary release of this before the final version is ready?

I would be willing to test the current state of this out on our projects.

@ChristianMurphyChristianMurphy mentioned this pull request Feb 18, 2024
5 tasks
@ChristianMurphy

Copy link
Copy Markdown
MemberAuthor

Welcome @karlhorky! 👋
Generally we don't publish alpha releases.
But once migrate TypeScript files to JavaScript with JSDoc based Typescript is complete
npm install remarkjs/react-remark#commit will work.

To your implied question of when will this PR land?
Not soon, my focus is elsewhere (both on professional projects and other volunteer unified initiatives) for at least the next month or so, and as far as I'm aware the same goes for most of the other remark maintainers as well.
This is still on the roadmap though.
If you'd like to contribute to moving this forward through PRs, you are welcome to!

Comment threadpackage.json
"husky": "^7.0.0",
"katex": "^0.13.0",
"pinst": "^2.0.0",
"prettier": "^2.0.0",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not v3?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this PR came before v3 was released 🙂
V3 would be good to include

Comment threadpackage.json
"lint": "tsdx lint",
"prepare": "tsdx build",
"build": "tsc && type-coverage",
"test": "node --loader ts-node/esm ./test/index.test.ts",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend to use lite https://github.com/privatenumber/tsx over ts-node, types linting can be a seperate task via tsc.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, though neither will be needed in the end.

The goal is:

migrate TypeScript files to JavaScript with JSDoc based Typescript

@karlhorky

karlhorky commented Feb 19, 2024

Copy link
Copy Markdown

Generally we don't publish alpha releases.
But once migrate TypeScript files to JavaScript with JSDoc based Typescript is complete
npm install remarkjs/react-remark#commit will work.

Ok, thanks for the response.

Which files would be the minimum files to get converted to JSDoc Based TypeScript to get this working on a commit install? Just src/index.ts -> src/index.js?

@karlhorky

karlhorky commented Feb 19, 2024

Copy link
Copy Markdown

Workaround

Until this is published, I'm using this code for useRemarkSync (Next.js App Router / RSC / SSR), in case useful for anyone:

Remark.tsx

import{ReactElement}from'react';import*asprodfrom'react/jsx-runtime';importrehypeReact,{Components,OptionsasRehypeReactOptions,}from'rehype-react';importremarkGfmfrom'remark-gfm';importremarkParse,{OptionsasRemarkParseOptions}from'remark-parse';importremarkToRehype,{OptionsasRemarkRehypeOptions}from'remark-rehype';import{PluggableList,unified}from'unified';// Copied + modfied from:// - https://github.com/remarkjs/react-remark/pull/39/files#diff-a2a171449d862fe29692ce031981047d7ab755ae7f84c707aef80701b3ea0c80R37//// Modifications:// - Removed Omit<>/PartialBy<> used on rehypeReactOptions// - Removed `?? true` from remarkToRehypeOptions// - Fixed option values for rehypeReact// - Used Partial<> with rehypeReactOptions//// TODO: Remove when PR #39 is merged or a new version is// released, making react-remark compatible with the other// plugins again// - https://github.com/remarkjs/react-remark/pull/39// - https://github.com/remarkjs/react-remark/issues/50#issuecomment-1123725393// - https://github.com/remarkjs/react-remark/issues/54#issuecomment-1654923707// - https://github.com/remarkjs/react-remark/issues/41interfaceUseRemarkSyncOptions{remarkParseOptions?: RemarkParseOptions;remarkToRehypeOptions?: RemarkRehypeOptions;rehypeReactOptions?: Partial<RehypeReactOptions>;remarkPlugins?: PluggableList;rehypePlugins?: PluggableList;}constuseRemarkSync=(source: string,{
remarkParseOptions,
remarkToRehypeOptions,
rehypeReactOptions,
remarkPlugins =[],
rehypePlugins =[],}: UseRemarkSyncOptions={},): ReactElement=>unified().use(remarkParse,remarkParseOptions).use(remarkPlugins).use(remarkToRehype,remarkToRehypeOptions).use(rehypePlugins).use(rehypeReact,{// @ts-expect-error: the react types are missing.Fragment: prod.Fragment,// @ts-expect-error: the react types are missing.jsx: prod.jsx,// @ts-expect-error: the react types are missing.jsxs: prod.jsxs,
...rehypeReactOptions,}asRehypeReactOptions).processSync(source).resultasReactElement;// Copied code ends heretypeProps={children: string;components: Partial<Components>;};exportdefaultfunctionRemark(props: Props){constreactContent=useRemarkSync(props.children,{remarkPlugins: [remarkGfm],rehypeReactOptions: {components: {
...props.components,},},});returnreactContent;}

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📦 area/depsThis affects dependencies📚 area/docsThis affects documentation🗄 area/interfaceThis affects the public interface🕸️ area/testsThis affects tests🏗 area/toolsThis affects tooling☂️ area/typesThis affects typings🛠 blocked/wipThis cannot progress yet, it’s being worked on🧑 semver/majorThis is a change

Development

Successfully merging this pull request may close these issues.

4 participants

@ChristianMurphy@karlhorky@JounQin@casperiv0