evanbacon / expo-mdx Goto Github PK
View Code? Open in Web Editor NEWAn attempt to render MDX universally across platforms
License: MIT License
An attempt to render MDX universally across platforms
License: MIT License
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.
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:
Repo is here: https://github.com/tsargent/mdx-demo
To run:
yarn install
npx pod-install
yarn ios
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>
)
}
Lines 104 to 114 in 2f50509
I suppose the comment should talk about MDXComponents
rather than MDXStyles
. Not sure if any other changes are needed
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.