Goosequill Shortcodes Reference

By Goose and Quill
8 minutes read

Table of Contents

  1. How to use them
  2. 1. Alert
  3. 2. ImageCode
  4. 3. Video
  5. 4. Youtube
  6. 5. Bilibili
  7. 6. Spotify
  8. 7. Steam
  9. 8. CRT
  10. Practical suggestions

Currently available shortcodes:

How to use them

In MDX, these components are already injected through ExtendMarkdown.astro, so you can write them directly like this:

<Alert type="note">Hello</Alert>

No extra import is required.

1. Alert

Renders a GitHub-style alert block.

Props

PropTypeDefaultDescription
type'note' | 'tip' | 'important' | 'warning' | 'caution''note'Alert style

Example

<Alert type="note">
This is a note.
</Alert>
<Alert type="warning">
This is a warning.
</Alert>

Notes

2. ImageCode

Renders an image with a set of combinable style classes.

Props

PropTypeDefaultDescription
urlstringOriginal image URL, required
url_minstringundefinedPreview/compressed image URL; when provided, the preview is shown and links to url
altstring''Alt text
fullbooleanfalseMakes the image fill the content width
full_bleedbooleanfalseLets the image extend beyond the content column
startbooleanfalseFloats the image to the start side
endbooleanfalseFloats the image to the end side
pixelsbooleanfalseUses pixel-art style rendering
transparentbooleanfalseBetter suited for transparent images
no_hoverbooleanfalseDisables hover zoom
spoilerbooleanfalseApplies spoiler masking
solidbooleanfalseStronger spoiler masking, used with spoiler

Example

<ImageCode
url="/images/example.png"
alt="Example image"
no_hover="true"
/>
<ImageCode
url="/images/original.png"
url_min="/images/preview.png"
alt="Clickable preview"
full="true"
/>

Notes

3. Video

Renders a local or remote video and supports most of the same presentation classes as ImageCode.

Props

PropTypeDefaultDescription
urlstringVideo URL, required
altstring''Accessibility text used as aria-label
fullbooleanfalseFills the content width
full_bleedbooleanfalseWider presentation
startbooleanfalseFloats to the start side
endbooleanfalseFloats to the end side
pixelsbooleanfalsePixel-art rendering style
transparentbooleanfalseTransparent presentation style
spoilerbooleanfalseSpoiler masking
solidbooleanfalseStronger masking when used with spoiler
autoplaybooleanfalseAutoplays the video
controlsbooleanfalseShows native controls
loopbooleanfalseLoops playback
mutedbooleanfalseStarts muted
playsinlinebooleanfalseRequests inline playback

Example

<Video
url="/videos/demo.webm"
alt="Demo video"
controls="true"
/>
<Video
url="/videos/hero.webm"
full_bleed="true"
autoplay="true"
muted="true"
loop="true"
playsinline="true"
/>

Notes

4. Youtube

Embeds a YouTube video using the youtube-nocookie.com domain.

Props

PropTypeDefaultDescription
idstringYouTube video ID, required
autoplaybooleanfalseWhether to autoplay
startnumberundefinedStart time in seconds

Example

<Youtube id="0Da8ZhKcNKQ" />
<Youtube id="0Da8ZhKcNKQ" autoplay="true" start={30} />

Notes

5. Bilibili

Embeds the Bilibili player.

Props

PropTypeDefaultDescription
bvidstringundefinedBV ID
aidstringundefinedAV ID
cidstringundefinedResource / danmaku ID
pagenumber1Part number
autoplaybooleanfalseWhether to autoplay

Example

<Bilibili bvid="BV1yt4y1Q7SS" />
<Bilibili
bvid="BV1yt4y1Q7SS"
page={2}
autoplay="true"
/>

Notes

6. Spotify

Embeds Spotify content such as albums, playlists, tracks, shows, and episodes.

Props

PropTypeDefaultDescription
type'track' | 'album' | 'artist' | 'playlist' | 'episode' | 'show'undefinedGeneric type form
idstringundefinedContent ID used with type
trackstringundefinedTrack ID shorthand
albumstringundefinedAlbum ID shorthand
artiststringundefinedArtist ID shorthand
playliststringundefinedPlaylist ID shorthand
episodestringundefinedEpisode ID shorthand
showstringundefinedShow ID shorthand
heightstring | numberautoCustom iframe height

Example

<Spotify album="5gDJVilnZpPt8zwBC467UH" />
<Spotify type="track" id="11dFghVXANMlKmJXsNCbNl" />
<Spotify playlist="37i9dQZF1DXcBWIGoYBM5M" height={480} />

Notes

7. Steam

Displays a Steam store card.

Props

PropTypeDefaultDescription
appidstring | numberSteam App ID, required
variant'horizontal' | 'vertical''horizontal'Card layout

Example

<Steam appid="1127400" />
<Steam appid="730" variant="vertical" />

Notes

8. CRT

Renders a CRT-styled code container.

Props

PropTypeDefaultDescription
codestringCode text to display, required
no_scanlinesbooleanfalseDisables scanline effect

Example

<CRT code={`
Hello, CRT
`} />
<CRT
no_scanlines="true"
code={`
No scanlines here
`}
/>

Notes

Practical suggestions

Media

Embeds

Alerts and presentation