-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2fec478
commit 6f50068
Showing
6 changed files
with
789 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# @astrojs/markdoc 📝 | ||
|
||
This **[Astro integration][astro-integration]** enables the usage of [Markdoc](https://markdoc.dev/) to create components, pages, and content collection entries. | ||
|
||
- <strong>[Why Markdoc?](#why-markdoc)</strong> | ||
- <strong>[Installation](#installation)</strong> | ||
- <strong>[Usage](#usage)</strong> | ||
- <strong>[Configuration](#configuration)</strong> | ||
- <strong>[Examples](#examples)</strong> | ||
- <strong>[Troubleshooting](#troubleshooting)</strong> | ||
- <strong>[Contributing](#contributing)</strong> | ||
- <strong>[Changelog](#changelog)</strong> | ||
|
||
## Why Markdoc? | ||
|
||
Markdoc allows you to enhance your Markdown with [UI components][astro-ui-frameworks]. If you have existing content authored in Markdoc, this integration allows you to bring those files to your Astro project. | ||
|
||
## Installation | ||
|
||
### Quick Install | ||
|
||
The `astro add` command-line tool automates the installation for you. Run one of the following commands in a new terminal window. (If you aren't sure which package manager you're using, run the first command.) Then, follow the prompts, and type "y" in the terminal (meaning "yes") for each one. | ||
|
||
```sh | ||
# Using NPM | ||
npx astro add markdoc | ||
# Using Yarn | ||
yarn astro add markdoc | ||
# Using PNPM | ||
pnpm astro add markdoc | ||
``` | ||
|
||
If you run into any issues, [feel free to report them to us on GitHub](https://github.com/withastro/astro/issues) and try the manual installation steps below. | ||
|
||
### Manual Install | ||
|
||
First, install the `@astrojs/markdoc` package using your package manager. If you're using npm or aren't sure, run this in the terminal: | ||
|
||
```sh | ||
npm install @astrojs/markdoc | ||
``` | ||
|
||
Then, apply this integration to your `astro.config.*` file using the `integrations` property: | ||
|
||
__`astro.config.mjs`__ | ||
|
||
```js ins={2} "markdoc()" | ||
import { defineConfig } from 'astro/config'; | ||
import markdoc from '@astrojs/markdoc'; | ||
|
||
export default defineConfig({ | ||
// ... | ||
integrations: [markdoc()], | ||
}); | ||
``` | ||
|
||
## Usage | ||
|
||
TODO | ||
|
||
## Configuration | ||
|
||
TODO | ||
|
||
## Examples | ||
|
||
TODO | ||
|
||
## Troubleshooting | ||
|
||
For help, check out the `#support` channel on [Discord](https://astro.build/chat). Our friendly Support Squad members are here to help! | ||
|
||
You can also check our [Astro Integration Documentation][astro-integration] for more on integrations. | ||
|
||
## Contributing | ||
|
||
This package is maintained by Astro's Core team. You're welcome to submit an issue or PR! | ||
|
||
## Changelog | ||
|
||
See [CHANGELOG.md](https://github.com/withastro/astro/tree/main/packages/integrations/markdoc/CHANGELOG.md) for a history of changes to this integration. | ||
|
||
[astro-integration]: https://docs.astro.build/en/guides/integrations-guide/ | ||
|
||
[astro-ui-frameworks]: https://docs.astro.build/en/core-concepts/framework-components/#using-framework-components |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"name": "@astrojs/markdoc", | ||
"description": "Use Markdoc within Astro", | ||
"version": "0.0.1", | ||
"type": "module", | ||
"types": "./dist/index.d.ts", | ||
"author": "withastro", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/withastro/astro.git", | ||
"directory": "packages/integrations/markdoc" | ||
}, | ||
"keywords": [ | ||
"astro-integration", | ||
"astro-component", | ||
"markdoc" | ||
], | ||
"bugs": "https://github.com/withastro/astro/issues", | ||
"homepage": "https://docs.astro.build/en/guides/integrations-guide/markdoc/", | ||
"exports": { | ||
".": "./dist/index.js", | ||
"./package.json": "./package.json" | ||
}, | ||
"scripts": { | ||
"build": "astro-scripts build \"src/**/*.ts\" && tsc", | ||
"build:ci": "astro-scripts build \"src/**/*.ts\"", | ||
"dev": "astro-scripts dev \"src/**/*.ts\"", | ||
"test": "mocha --exit --timeout 20000", | ||
"test:match": "mocha --timeout 20000 -g" | ||
}, | ||
"dependencies": { | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "^4.3.1", | ||
"@types/mocha": "^9.1.1", | ||
"astro": "workspace:*", | ||
"astro-scripts": "workspace:*", | ||
"chai": "^4.3.6", | ||
"linkedom": "^0.14.12", | ||
"mocha": "^9.2.2", | ||
"vite": "^4.0.3" | ||
}, | ||
"engines": { | ||
"node": ">=16.12.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { AstroIntegration } from 'astro'; | ||
|
||
export default function markdoc(partialOptions: {} = {}): AstroIntegration { | ||
return { | ||
name: '@astrojs/markdoc', | ||
hooks: { | ||
'astro:config:setup': async ({ updateConfig, config, addPageExtension, command }: any) => { | ||
addPageExtension('.mdoc'); | ||
console.log('Markdoc working!'); | ||
}, | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "../../../tsconfig.base.json", | ||
"include": ["src"], | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"module": "ES2020", | ||
"outDir": "./dist", | ||
"target": "ES2020" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.