Add interfaces for built-in components (#1292)
* Add interfaces for built-in components * Adds a changeset
This commit is contained in:
parent
fba0446666
commit
231964f084
3 changed files with 23 additions and 2 deletions
5
.changeset/perfect-kids-occur.md
Normal file
5
.changeset/perfect-kids-occur.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Adds interfaces for built-in components
|
|
@ -1,7 +1,16 @@
|
||||||
---
|
---
|
||||||
import { renderMarkdown } from '@astrojs/markdown-support';
|
import { renderMarkdown } from '@astrojs/markdown-support';
|
||||||
|
|
||||||
const { content, $scope } = Astro.props;
|
export interface Props {
|
||||||
|
content?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Internal props that should not be part of the external interface.
|
||||||
|
interface InternalProps extends Props {
|
||||||
|
$scope: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { content, $scope } = Astro.props as InternalProps;
|
||||||
let html = null;
|
let html = null;
|
||||||
|
|
||||||
// This flow is only triggered if a user passes `<Markdown content={content} />`
|
// This flow is only triggered if a user passes `<Markdown content={content} />`
|
||||||
|
|
|
@ -3,7 +3,14 @@ import Prism from 'prismjs';
|
||||||
import { addAstro } from '@astrojs/prism';
|
import { addAstro } from '@astrojs/prism';
|
||||||
import loadLanguages from 'prismjs/components/index.js';
|
import loadLanguages from 'prismjs/components/index.js';
|
||||||
|
|
||||||
const { class: className, lang, code } = Astro.props;
|
export interface Props {
|
||||||
|
class?: string;
|
||||||
|
lang?: string;
|
||||||
|
code: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { class: className, lang, code } = Astro.props as Props;
|
||||||
|
|
||||||
let classLanguage = `language-${lang}`
|
let classLanguage = `language-${lang}`
|
||||||
|
|
||||||
const languageMap = new Map([
|
const languageMap = new Map([
|
||||||
|
|
Loading…
Add table
Reference in a new issue