Skip to content

Commit

Permalink
[fix] parsing md files
Browse files Browse the repository at this point in the history
  • Loading branch information
lowk3v committed Oct 10, 2023
1 parent f9ee1cf commit 4806292
Show file tree
Hide file tree
Showing 10 changed files with 240 additions and 13 deletions.
109 changes: 109 additions & 0 deletions .contentlayer/.cache/v0.3.2/compiled-contentlayer-config-WSC433HJ.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// contentlayer.config.js
import { defineDocumentType, makeSource } from "contentlayer/source-files";
import remarkGfm from "remark-gfm";
import rehypePrettyCode from "rehype-pretty-code";
import rehypeSlug from "rehype-slug";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
var computedFields = {
path: {
type: "string",
resolve: (doc) => `/${doc._raw.flattenedPath}`
},
slug: {
type: "string",
resolve: (doc) => doc._raw.flattenedPath.split("/").slice(1).join("/")
}
};
var Project = defineDocumentType(() => ({
name: "Project",
filePathPattern: "./projects/**/*.md",
contentType: "mdx",
fields: {
published: {
type: "boolean"
},
title: {
type: "string",
required: true
},
description: {
type: "string",
required: true
},
date: {
type: "date"
},
url: {
type: "string"
},
repository: {
type: "string"
},
author: {
type: "string",
default: "LowK"
},
featured: {
type: "boolean",
default: false
}
},
computedFields
}));
var Page = defineDocumentType(() => ({
name: "Page",
filePathPattern: "pages/**/*.md",
contentType: "mdx",
fields: {
title: {
type: "string",
required: true
},
description: {
type: "string"
}
},
computedFields
}));
var contentlayer_config_default = makeSource({
contentDirPath: "./content",
documentTypes: [Page, Project],
mdx: {
remarkPlugins: [remarkGfm],
rehypePlugins: [
rehypeSlug,
[
rehypePrettyCode,
{
theme: "github-dark",
onVisitLine(node) {
if (node.children.length === 0) {
node.children = [{ type: "text", value: " " }];
}
},
onVisitHighlightedLine(node) {
node.properties.className.push("line--highlighted");
},
onVisitHighlightedWord(node) {
node.properties.className = ["word--highlighted"];
}
}
],
[
rehypeAutolinkHeadings,
{
properties: {
className: ["subheading-anchor"],
ariaLabel: "Link to section"
}
}
]
]
}
});
export {
Page,
Project,
contentlayer_config_default as default
};
//# sourceMappingURL=compiled-contentlayer-config-WSC433HJ.mjs.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../../contentlayer.config.js"],
"sourcesContent": ["import { defineDocumentType, makeSource } from \"contentlayer/source-files\";\nimport remarkGfm from \"remark-gfm\";\nimport rehypePrettyCode from \"rehype-pretty-code\";\nimport rehypeSlug from \"rehype-slug\";\nimport rehypeAutolinkHeadings from \"rehype-autolink-headings\";\n\n/** @type {import('contentlayer/source-files').ComputedFields} */\nconst computedFields = {\n\tpath: {\n\t\ttype: \"string\",\n\t\tresolve: (doc) => `/${doc._raw.flattenedPath}`,\n\t},\n\tslug: {\n\t\ttype: \"string\",\n\t\tresolve: (doc) => doc._raw.flattenedPath.split(\"/\").slice(1).join(\"/\"),\n\t},\n};\n\nexport const Project = defineDocumentType(() => ({\n\tname: \"Project\",\n\tfilePathPattern: \"./projects/**/*.md\",\n\tcontentType: \"mdx\",\n\n\tfields: {\n\t\tpublished: {\n\t\t\ttype: \"boolean\",\n\t\t},\n\t\ttitle: {\n\t\t\ttype: \"string\",\n\t\t\trequired: true,\n\t\t},\n\t\tdescription: {\n\t\t\ttype: \"string\",\n\t\t\trequired: true,\n\t\t},\n\t\tdate: {\n\t\t\ttype: \"date\",\n\t\t},\n\t\turl: {\n\t\t\ttype: \"string\",\n\t\t},\n\t\trepository: {\n\t\t\ttype: \"string\",\n\t\t},\n\t\tauthor: {\n\t\t\ttype: \"string\",\n\t\t\tdefault: \"LowK\"\n\t\t},\n\t\tfeatured: {\n\t\t\ttype: \"boolean\",\n\t\t\tdefault: false,\n\t\t}\n\t},\n\tcomputedFields,\n}));\n\nexport const Page = defineDocumentType(() => ({\n\tname: \"Page\",\n\tfilePathPattern: \"pages/**/*.md\",\n\tcontentType: \"mdx\",\n\tfields: {\n\t\ttitle: {\n\t\t\ttype: \"string\",\n\t\t\trequired: true,\n\t\t},\n\t\tdescription: {\n\t\t\ttype: \"string\",\n\t\t},\n\t},\n\tcomputedFields,\n}));\n\nexport default makeSource({\n\tcontentDirPath: \"./content\",\n\tdocumentTypes: [Page, Project],\n\tmdx: {\n\t\tremarkPlugins: [remarkGfm],\n\t\trehypePlugins: [\n\t\t\trehypeSlug,\n\t\t\t[\n\t\t\t\trehypePrettyCode,\n\t\t\t\t{\n\t\t\t\t\ttheme: \"github-dark\",\n\t\t\t\t\tonVisitLine(node) {\n\t\t\t\t\t\t// Prevent lines from collapsing in `display: grid` mode, and allow empty\n\t\t\t\t\t\t// lines to be copy/pasted\n\t\t\t\t\t\tif (node.children.length === 0) {\n\t\t\t\t\t\t\tnode.children = [{ type: \"text\", value: \" \" }];\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tonVisitHighlightedLine(node) {\n\t\t\t\t\t\tnode.properties.className.push(\"line--highlighted\");\n\t\t\t\t\t},\n\t\t\t\t\tonVisitHighlightedWord(node) {\n\t\t\t\t\t\tnode.properties.className = [\"word--highlighted\"];\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\t[\n\t\t\t\trehypeAutolinkHeadings,\n\t\t\t\t{\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tclassName: [\"subheading-anchor\"],\n\t\t\t\t\t\tariaLabel: \"Link to section\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t],\n\t},\n});\n"],
"mappings": ";AAAA,SAAS,oBAAoB,kBAAkB;AAC/C,OAAO,eAAe;AACtB,OAAO,sBAAsB;AAC7B,OAAO,gBAAgB;AACvB,OAAO,4BAA4B;AAGnC,IAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,MAAM;AAAA,IACN,SAAS,CAAC,QAAQ,IAAI,IAAI,KAAK;AAAA,EAChC;AAAA,EACA,MAAM;AAAA,IACL,MAAM;AAAA,IACN,SAAS,CAAC,QAAQ,IAAI,KAAK,cAAc,MAAM,GAAG,EAAE,MAAM,CAAC,EAAE,KAAK,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AK,WAAW,UAAU,KAAK,mBAAmB;AAAA,UACnD;AAAA,UACA,uBAAuB,MAAM;AAC5B,iBAAK,WAAW,YAAY,CAAC,mBAAmB;AAAA,UACjD;AAAA,QACD;AAAA,MACD;AAAA,MACA;AAAA,QACC;AAAA,QACA;AAAA,UACC,YAAY;AAAA,YACX,WAAW,CAAC,mBAAmB;AAAA,YAC/B,WAAW;AAAA,UACZ;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD,CAAC;",
"names": []
}
62 changes: 62 additions & 0 deletions .contentlayer/.cache/v0.3.2/data-WSC433HJ.json

Large diffs are not rendered by default.

34 changes: 29 additions & 5 deletions .contentlayer/generated/Project/_index.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions .contentlayer/generated/Project/_index.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// NOTE This file is auto-generated by Contentlayer

import projects__wooFiMdx from './projects__WooFi.mdx.json' assert { type: 'json' }
import projects__2023_10_10LayerZeroIntegrationsSecurityTipsMd from './projects__2023-10-10-LayerZero-Integrations-Security-Tips.md.json' assert { type: 'json' }
import projects__wooFiMd from './projects__WooFi.md.json' assert { type: 'json' }

export const allProjects = [projects__wooFiMdx]
export const allProjects = [projects__2023_10_10LayerZeroIntegrationsSecurityTipsMd, projects__wooFiMd]

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .contentlayer/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dot-contentlayer",
"description": "This package is auto-generated by Contentlayer",
"version": "0.0.0-7OOTH3RP",
"version": "0.0.0-WSC433HJ",
"exports": {
"./generated": {
"import": "./generated/index.mjs"
Expand Down
2 changes: 1 addition & 1 deletion app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default function Home() {
{
link: 'mailto:[email protected]',
title: (
<span>Review Your Project
<span>Request an audit
<span style={{ marginLeft: 10 }}>🔐</span>
</span>
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ when integrating LayerZero into your smart contracts.

## Security Tips

1. Calling `send()` with `{value: msg.value}` is because `send()` **requires a bit of native gas token** so the relayer can complete the message delivery on the destination chain. If you don't set this value [you might get this error](notion://www.notion.so/docs/evm-guides/error-messages/error-layerzero-relayer-fee-failed) when calling `endpoint.send()`
1. Calling `send()` with `{value: msg.value}` is because `send()` **requires a bit of native gas token** so the relayer can complete the message delivery on the destination chain. If you don't set this value you might get an error when calling `endpoint.send()`

2. In a received chain, A **msg.sender is the LZ endpoint**. Are there any mistakes?

Expand All @@ -27,7 +27,7 @@ when integrating LayerZero into your smart contracts.

Check the address size according to the source chain (e.g. address size == 20 bytes on EVM chains) to prevent a vector unauthenticated contract call.

4. In a received chain, parse srcAddress to the address type that is just applied for EVM chains. **Is your application connected with non-e chain?**
4. In a received chain, parse srcAddress to the address type that is just applied for EVM chains. **Is your application connected with non-evm chain?**

5. **Is there a set of trusted remote addresses**? The feature is available at some places that must be checked:
- retryPayload()::srcAddress
Expand Down
4 changes: 2 additions & 2 deletions contentlayer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const computedFields = {

export const Project = defineDocumentType(() => ({
name: "Project",
filePathPattern: "./projects/**/*.mdx",
filePathPattern: "./projects/**/*.md",
contentType: "mdx",

fields: {
Expand Down Expand Up @@ -56,7 +56,7 @@ export const Project = defineDocumentType(() => ({

export const Page = defineDocumentType(() => ({
name: "Page",
filePathPattern: "pages/**/*.mdx",
filePathPattern: "pages/**/*.md",
contentType: "mdx",
fields: {
title: {
Expand Down

0 comments on commit 4806292

Please sign in to comment.