feat: trying to figure out syntax highlighting
This commit is contained in:
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"typescript.tsdk": "node_modules\\typescript\\lib",
|
"typescript.tsdk": "node_modules\\typescript\\lib",
|
||||||
"typescript.enablePromptUseWorkspaceTsdk": true,
|
"typescript.enablePromptUseWorkspaceTsdk": true,
|
||||||
"cSpell.words": ["markdoc", "Onpsring"]
|
"cSpell.words": ["markdoc", "Onpsring", "prismjs"]
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+27
@@ -15,6 +15,7 @@
|
|||||||
"eslint": "8.38.0",
|
"eslint": "8.38.0",
|
||||||
"eslint-config-next": "13.3.0",
|
"eslint-config-next": "13.3.0",
|
||||||
"next": "13.2.4",
|
"next": "13.2.4",
|
||||||
|
"prismjs": "^1.29.0",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-dom": "18.2.0",
|
"react-dom": "18.2.0",
|
||||||
"typescript": "5.0.4"
|
"typescript": "5.0.4"
|
||||||
@@ -22,6 +23,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@testing-library/jest-dom": "^5.16.5",
|
"@testing-library/jest-dom": "^5.16.5",
|
||||||
"@testing-library/react": "^14.0.0",
|
"@testing-library/react": "^14.0.0",
|
||||||
|
"@types/prismjs": "^1.26.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"jest": "^29.5.0",
|
"jest": "^29.5.0",
|
||||||
@@ -1889,6 +1891,12 @@
|
|||||||
"integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==",
|
"integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/prismjs": {
|
||||||
|
"version": "1.26.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/prismjs/-/prismjs-1.26.0.tgz",
|
||||||
|
"integrity": "sha512-ZTaqn/qSqUuAq1YwvOFQfVW1AR/oQJlLSZVustdjwI+GZ8kr0MSHBj0tsXPW1EqHubx50gtBEjbPGsdZwQwCjQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/@types/prop-types": {
|
"node_modules/@types/prop-types": {
|
||||||
"version": "15.7.5",
|
"version": "15.7.5",
|
||||||
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz",
|
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz",
|
||||||
@@ -6495,6 +6503,14 @@
|
|||||||
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
|
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/prismjs": {
|
||||||
|
"version": "1.29.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz",
|
||||||
|
"integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/prompts": {
|
"node_modules/prompts": {
|
||||||
"version": "2.4.2",
|
"version": "2.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz",
|
||||||
@@ -9102,6 +9118,12 @@
|
|||||||
"integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==",
|
"integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@types/prismjs": {
|
||||||
|
"version": "1.26.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/prismjs/-/prismjs-1.26.0.tgz",
|
||||||
|
"integrity": "sha512-ZTaqn/qSqUuAq1YwvOFQfVW1AR/oQJlLSZVustdjwI+GZ8kr0MSHBj0tsXPW1EqHubx50gtBEjbPGsdZwQwCjQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@types/prop-types": {
|
"@types/prop-types": {
|
||||||
"version": "15.7.5",
|
"version": "15.7.5",
|
||||||
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz",
|
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz",
|
||||||
@@ -12436,6 +12458,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"prismjs": {
|
||||||
|
"version": "1.29.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz",
|
||||||
|
"integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q=="
|
||||||
|
},
|
||||||
"prompts": {
|
"prompts": {
|
||||||
"version": "2.4.2",
|
"version": "2.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz",
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
"eslint": "8.38.0",
|
"eslint": "8.38.0",
|
||||||
"eslint-config-next": "13.3.0",
|
"eslint-config-next": "13.3.0",
|
||||||
"next": "13.2.4",
|
"next": "13.2.4",
|
||||||
|
"prismjs": "^1.29.0",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-dom": "18.2.0",
|
"react-dom": "18.2.0",
|
||||||
"typescript": "5.0.4"
|
"typescript": "5.0.4"
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@testing-library/jest-dom": "^5.16.5",
|
"@testing-library/jest-dom": "^5.16.5",
|
||||||
"@testing-library/react": "^14.0.0",
|
"@testing-library/react": "^14.0.0",
|
||||||
|
"@types/prismjs": "^1.26.0",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"jest": "^29.5.0",
|
"jest": "^29.5.0",
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { MouseEvent, useState } from 'react';
|
import Prism from 'prismjs';
|
||||||
|
import 'prismjs/components/prism-json';
|
||||||
|
import 'prismjs/themes/prism.css';
|
||||||
|
|
||||||
|
import { MouseEvent, useEffect, useState } from 'react';
|
||||||
import styles from './Code.module.css';
|
import styles from './Code.module.css';
|
||||||
|
|
||||||
function CodeCopyButton() {
|
function CodeCopyButton() {
|
||||||
@@ -70,6 +74,10 @@ export default function Code({
|
|||||||
language: string;
|
language: string;
|
||||||
heading: string;
|
heading: string;
|
||||||
}) {
|
}) {
|
||||||
|
useEffect(() => {
|
||||||
|
Prism.highlightAll();
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.snippetContainer}>
|
<div className={styles.snippetContainer}>
|
||||||
<div className={styles.snippetHeader}>
|
<div className={styles.snippetHeader}>
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import Markdoc from '@markdoc/markdoc';
|
import { default as Markdoc } from '@markdoc/markdoc';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import React, { ReactNode } from 'react';
|
import React, { ReactNode } from 'react';
|
||||||
import Code from '../components/Code';
|
import Code from '../components/Code';
|
||||||
import { Doc, DocSection } from './../types/types';
|
import { Doc, DocSection } from './../types/types';
|
||||||
|
|
||||||
const DOCS_PATH = path.join(process.cwd(), 'src/docs');
|
const DOCS_PATH = path.join(process.cwd(), 'src/docs');
|
||||||
|
|
||||||
function getCopyPath(version: string, doc: Doc): string {
|
function getCopyPath(version: string, doc: Doc): string {
|
||||||
@@ -36,7 +37,6 @@ const markDocConfig = {
|
|||||||
tags: {
|
tags: {
|
||||||
code: {
|
code: {
|
||||||
render: 'Code',
|
render: 'Code',
|
||||||
children: ['text'],
|
|
||||||
attributes: {
|
attributes: {
|
||||||
language: {
|
language: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ curl --location 'https://api.onspring.com/Records/appId/195' \
|
|||||||
|
|
||||||
{% code heading="RESPONSE" language="json" %}
|
{% code heading="RESPONSE" language="json" %}
|
||||||
|
|
||||||
```json
|
```json {% .language-json %}
|
||||||
{
|
{
|
||||||
"pageNumber": 1,
|
"pageNumber": 1,
|
||||||
"pageSize": 1,
|
"pageSize": 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user