Initial editor tabs implementation with CAD package guides #519
@@ -1,7 +1,12 @@
|
||||
|
|
||||
// Extracts YAML frontmatter from Markdown files
|
||||
// Gotten from this helpful comment on a react-markdown GitHub Issue: https://github.com/remarkjs/react-markdown/issues/164#issuecomment-890497653
|
||||
export function extractMetaData(text: string): Array<any> {
|
||||
|
Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe
```suggestion
export function useMarkdownMetaData(text: string): Array<any> {
return React.useMemo(() => {
const metaData = {} as any
/* ... */
return [rawMetaData, metaData]
}, [text])
}
```
Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful. Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful.
|
||||
const metaData = {} as any
|
||||
|
Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe
```suggestion
export function useMarkdownMetaData(text: string): Array<any> {
return React.useMemo(() => {
const metaData = {} as any
/* ... */
return [rawMetaData, metaData]
}, [text])
}
```
Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful. Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful.
|
||||
export function useMarkdownMetaData(text: string): Array<any> {
|
||||
|
Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe
```suggestion
export function useMarkdownMetaData(text: string): Array<any> {
return React.useMemo(() => {
const metaData = {} as any
/* ... */
return [rawMetaData, metaData]
}, [text])
}
```
Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful. Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful.
|
||||
return React.useMemo(() => {
|
||||
|
Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe
```suggestion
export function useMarkdownMetaData(text: string): Array<any> {
return React.useMemo(() => {
const metaData = {} as any
/* ... */
return [rawMetaData, metaData]
}, [text])
}
```
Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful. Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful.
|
||||
const metaData = {} as any
|
||||
|
Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe
```suggestion
export function useMarkdownMetaData(text: string): Array<any> {
return React.useMemo(() => {
const metaData = {} as any
/* ... */
return [rawMetaData, metaData]
}, [text])
}
```
Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful. Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful.
|
||||
/* ... */
|
||||
|
Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe
```suggestion
export function useMarkdownMetaData(text: string): Array<any> {
return React.useMemo(() => {
const metaData = {} as any
/* ... */
return [rawMetaData, metaData]
}, [text])
}
```
Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful. Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful.
|
||||
return [rawMetaData, metaData]
|
||||
|
Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe
```suggestion
export function useMarkdownMetaData(text: string): Array<any> {
return React.useMemo(() => {
const metaData = {} as any
/* ... */
return [rawMetaData, metaData]
}, [text])
}
```
Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful. Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful.
|
||||
}, [text])
|
||||
|
Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe
```suggestion
export function useMarkdownMetaData(text: string): Array<any> {
return React.useMemo(() => {
const metaData = {} as any
/* ... */
return [rawMetaData, metaData]
}, [text])
}
```
Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful. Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful.
|
||||
}
|
||||
|
Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe
```suggestion
export function useMarkdownMetaData(text: string): Array<any> {
return React.useMemo(() => {
const metaData = {} as any
/* ... */
return [rawMetaData, metaData]
}, [text])
}
```
Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful. Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful.
|
||||
|
||||
const metaRegExp = RegExp(/^---[\r\n](((?!---).|[\r\n])*)[\r\n]---$/m)
|
||||
// get metadata
|
||||
|
||||
|
Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe
```suggestion
export function useMarkdownMetaData(text: string): Array<any> {
return React.useMemo(() => {
const metaData = {} as any
/* ... */
return [rawMetaData, metaData]
}, [text])
}
```
Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe
```suggestion
export function useMarkdownMetaData(text: string): Array<any> {
return React.useMemo(() => {
const metaData = {} as any
/* ... */
return [rawMetaData, metaData]
}, [text])
}
```
Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful. Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful.
Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful. Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful.
|
||||
Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe
Maybe this falls into the bucket of preemptive optimisations but I think it's okay since its not adding much more complexity or new patterns. Basically I'm not sure how expensive regular expressions can be to run over and over so might be best to play it safe
Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful.
Ah of course I hadn't thought of this rerendering a bunch of times! Thank you seems very helpful.