Coder Social home page Coder Social logo

expo-mdx's People

Contributors

evanbacon avatar izakfilmalter avatar phatmann avatar wodin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

expo-mdx's Issues

[Security vulnerability] Please bump up the version of `@mdx-js/mdx`

Hi, your package is throwing a security vulnerability:

trim
├─ ID: 1089867
├─ Issue: Regular Expression Denial of Service in trim
├─ URL: GHSA-w5p7-h5w8-2hfq
├─ Severity: high
├─ Vulnerable Versions: <0.0.3
│ (\n)?
│ (\n)?
├─ Tree Versions
│ └─ 0.0.1
└─ Dependents
└─ remark-parse@npm:8.0.3

remark-parse is a dependency of @mdx-js/mdx. You are currently running with a quite old version v1.6.22. Can you please bump this dependency up? The last one is already at v3.0.0.

Thank you very much for your support and the library itself.

How to access frontmatter

Does this package support accessing the frontmatter from the markdown? I have demo repo where I have the required remark plugin here: https://github.com/tsargent/mdx-demo/blob/main/metro.transformer.js#L4-L15

The rest of the mdx is working great. It renders as expected, and the components from the markdown work. I'm just a bit confused about how to access the frontmatter.

My markdown looks like this:

---
foo: bar
---

import CustomComponent from './CustomComponent.js';

# Hello World

I **am** a _markdown_ file! [link](https://google.com)

<CustomComponent title="Hello!" />

Another line

But it renders like this, with the fontmatter included:
Screenshot 2023-11-24 at 11 26 55 AM

Repo is here: https://github.com/tsargent/mdx-demo

To run:

yarn install
npx pod-install
yarn ios

Types: MdxComponents types were not working for me

Hi, not sure if it's something that needs to change in the repo or not but i had to change the types in the package for the MDXComponents to :

export declare function MDXComponents({ children, components, ...props }: {
    children?: any;
    components?: Partial<Record<keyof ReturnType<typeof getBaseElements>, (props: any) => JSX.Element>>;
} & Partial<Elements>): JSX.Element;

the current types expect components to be Record<string, React.ReactNode> but when i was passing something like :

<MDXComponents components={{
  h1: (props) => <Text {...props} />
}} />

I was getting an error on typescript saying (props:any) => Elements is not compatible with ReactNode. I tried to use our custom Text component but also with the one from react-native and was still getting the error.

If you think the change is valid, let me know and i can submit the Pr or let you do it if you prefer :)

also not sure for a generic version of it and a compatible one with web but for the UL component i'm doing this and it seems to be working for us (Box is a View):

const UL = ({ children }: PropsWithChildren<{}>) => {
	return (
		<Box>
			{Children.map(children, (child) => (
				<Text variant="body" mb="xsmall">
					 {child}
				</Text>
			))}
		</Box>
	)
}

Incorrect comment

expo-mdx/README.md

Lines 104 to 114 in 2f50509

import { Text } from "react-native";
import { MDXComponents } from "@bacons/mdx";
export default function App() {
// Pass any HTML element as a key to the MDXStyles component.
return (
<MDXComponents h1={(props) => <Text {...props} />}>
<Demo />
</MDXComponents>
);
}

I suppose the comment should talk about MDXComponents rather than MDXStyles. Not sure if any other changes are needed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.