diff --git a/next.config.js b/next.config.js deleted file mode 100644 index afdca23..0000000 --- a/next.config.js +++ /dev/null @@ -1,8 +0,0 @@ -const withMDX = require('@next/mdx')({ - extension: /\.mdx?$/, -}) -module.exports = withMDX({ - output: 'export', - basePath: process.env.BASE_PATH ?? '', - pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md', 'mdx'], -}) \ No newline at end of file diff --git a/next.config.mjs b/next.config.mjs new file mode 100644 index 0000000..3d446a7 --- /dev/null +++ b/next.config.mjs @@ -0,0 +1,18 @@ +import nextMdx from '@next/mdx' +import remarkFrontmatter from 'remark-frontmatter'; +import remarkMdxFrontmatter from 'remark-mdx-frontmatter'; + +const withMdx = nextMdx({ + extension: /\.mdx?$/, + options: { + jsx: true, + remarkPlugins: [remarkFrontmatter, [remarkMdxFrontmatter, { name: 'frontmatter' }]], + rehypePlugins: [] + }, +}) + +export default withMdx({ + output: 'export', + basePath: process.env.BASE_PATH ?? '', + pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'] +}) \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index fa24728..e3d1621 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,8 @@ "react": "18.2.0", "react-dom": "18.2.0", "react-hook-form": "^7.44.3", + "remark-frontmatter": "^5.0.0", + "remark-mdx-frontmatter": "^5.0.0", "typescript": "5.0.4" }, "devDependencies": { @@ -2362,6 +2364,17 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/estree-util-value-to-estree": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/estree-util-value-to-estree/-/estree-util-value-to-estree-3.1.2.tgz", + "integrity": "sha512-S0gW2+XZkmsx00tU2uJ4L9hUT7IFabbml9pHh2WQqFmAbxit++YGZne0sKJbNwkj9Wvg9E4uqWl4nCIFQMmfag==", + "dependencies": { + "@types/estree": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/remcohaszing" + } + }, "node_modules/estree-util-visit": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/estree-util-visit/-/estree-util-visit-2.0.0.tgz", @@ -2454,6 +2467,18 @@ "reusify": "^1.0.4" } }, + "node_modules/fault": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fault/-/fault-2.0.1.tgz", + "integrity": "sha512-WtySTkS4OKev5JtpHXnib4Gxiurzh5NCGvWrFaZ34m6JehfTUhKZvn9njTfw48t6JumVQOmrKqpmGcdwxnhqBQ==", + "dependencies": { + "format": "^0.2.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -2517,6 +2542,14 @@ "is-callable": "^1.1.3" } }, + "node_modules/format": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", + "integrity": "sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==", + "engines": { + "node": ">=0.4.x" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -3701,6 +3734,34 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/mdast-util-frontmatter": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-frontmatter/-/mdast-util-frontmatter-2.0.1.tgz", + "integrity": "sha512-LRqI9+wdgC25P0URIJY9vwocIzCcksduHQ9OF2joxQoyTNVduwLAFUzjoopuRJbJAReaKrNQKAZKL3uCMugWJA==", + "dependencies": { + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "escape-string-regexp": "^5.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "micromark-extension-frontmatter": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-frontmatter/node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/mdast-util-mdx": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/mdast-util-mdx/-/mdast-util-mdx-3.0.0.tgz", @@ -3920,6 +3981,21 @@ "micromark-util-types": "^2.0.0" } }, + "node_modules/micromark-extension-frontmatter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-frontmatter/-/micromark-extension-frontmatter-2.0.0.tgz", + "integrity": "sha512-C4AkuM3dA58cgZha7zVnuVxBhDsbttIMiytjgsM2XbHAB2faRVaHRle40558FBN+DJcrLNCoqG5mlrpdU4cRtg==", + "dependencies": { + "fault": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/micromark-extension-mdx-expression": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/micromark-extension-mdx-expression/-/micromark-extension-mdx-expression-3.0.0.tgz", @@ -5203,6 +5279,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/remark-frontmatter": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/remark-frontmatter/-/remark-frontmatter-5.0.0.tgz", + "integrity": "sha512-XTFYvNASMe5iPN0719nPrdItC9aU0ssC4v14mH1BCi1u0n1gAocqcujWUrByftZTbLhRtiKRyjYTSIOcr69UVQ==", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-frontmatter": "^2.0.0", + "micromark-extension-frontmatter": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/remark-mdx": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/remark-mdx/-/remark-mdx-3.0.1.tgz", @@ -5216,6 +5307,33 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/remark-mdx-frontmatter": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/remark-mdx-frontmatter/-/remark-mdx-frontmatter-5.0.0.tgz", + "integrity": "sha512-kI75pshe27TM71R+0iX7C3p4MbGMdygkvSbrk1WYSar88WAwR2JfQilofcDGgDNFAWUo5IwTPyq9XvGpifTwqQ==", + "dependencies": { + "@types/mdast": "^4.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "estree-util-value-to-estree": "^3.0.0", + "toml": "^3.0.0", + "unified": "^11.0.0", + "yaml": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/remcohaszing" + } + }, + "node_modules/remark-mdx-frontmatter/node_modules/yaml": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.5.tgz", + "integrity": "sha512-aBx2bnqDzVOyNKfsysjA2ms5ZlnjSAW2eG3/L5G/CSujfjLJTJsEw1bGw8kCf04KodQWk1pxlGnZ56CRxiawmg==", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/remark-parse": { "version": "11.0.0", "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", @@ -5877,6 +5995,11 @@ "node": ">=8.0" } }, + "node_modules/toml": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz", + "integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==" + }, "node_modules/trim-lines": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", diff --git a/package.json b/package.json index b80e071..e79f411 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,8 @@ "react": "18.2.0", "react-dom": "18.2.0", "react-hook-form": "^7.44.3", + "remark-frontmatter": "^5.0.0", + "remark-mdx-frontmatter": "^5.0.0", "typescript": "5.0.4" }, "devDependencies": { diff --git a/src/app/page.tsx b/src/app/page.tsx index 78f3e77..69a8769 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -11,12 +11,12 @@ import { Section } from "@/components/Section/Section"; import { DataIcon } from "@/components/icons/DataIcon"; import { QueryIcon } from "@/components/icons/QueryIcon"; import Resources from '../content/resources.mdx' -import { tools } from '../content/tools.mdx' +import { frontmatter as tools } from '../content/tools.mdx' import Funding from '../content/funding.mdx' import License from '../content/license.mdx' import Events from '../content/events.mdx' -interface Tool { +interface Tools { title: string; link: string; description: string; diff --git a/src/content/tools.mdx b/src/content/tools.mdx index ba26355..4c0dfe7 100644 --- a/src/content/tools.mdx +++ b/src/content/tools.mdx @@ -1,18 +1,23 @@ -export const tools = [ - { - title: "ROBOKOP KG", - link: "http://robokopkg.renci.org/", - description: "ROBOKOP KG is an open-source biomedical knowledge graph containing ~10M nodes and ~250M edges drawn from ~30 biological data sources and bio-ontologies. Query the ROBOKOP KG directly in the Neo4j browser." - }, - { - title: "ExEmPLAR", - link: "https://www.exemplar.mml.unc.edu/", - warning: "ExEmplar is under development and should be considered an experimental alternative to the ROBOKOP UI.", - description: "ExEmplar is a generic Neo4j query-and-answer exploration tool that supports queries of the ROBOKOP KG and other Neo4j databases." - }, - { - title: "RoboDocumentation", - link: "https://github.com/RobokopU24/RoboDocumentation/", - description: "A collection of notebooks and other documents to help users get the most out of ROBOKOP." - } - ] \ No newline at end of file +--- +- title: "ROBOKOP KG" + link: "http://robokopkg.renci.org/" + description: > + ROBOKOP KG is an open-source biomedical knowledge graph + containing ~10M nodes and ~250M edges drawn from ~30 + biological data sources and bio-ontologies. Query the + ROBOKOP KG directly in the Neo4j browser. +- title: "ExEmPLAR" + link: "https://www.exemplar.mml.unc.edu/" + warning: > + ExEmplar is under development and should be considered an + experimental alternative to the ROBOKOP UI. + description: > + ExEmplar is a generic Neo4j query-and-answer exploration + tool that supports queries of the ROBOKOP KG and other + Neo4j databases. +- title: "RoboDocumentation" + link: "https://github.com/RobokopU24/RoboDocumentation/" + description: > + A collection of notebooks and other documents to help + users get the most out of ROBOKOP. +--- \ No newline at end of file diff --git a/src/mdx-components.tsx b/src/mdx-components.tsx index 66758df..2ad5060 100644 --- a/src/mdx-components.tsx +++ b/src/mdx-components.tsx @@ -10,3 +10,10 @@ export function useMDXComponents(components: MDXComponents): MDXComponents { ...components, } } + +declare module '*.mdx' { + // This is the export key for the frontmatter (defined in the next.config.mjs file) + // If the shape of the frontmatter gets more complex, we can define a better type + // here or use a runtime validator like zod. + export const frontmatter: any; +}