inlay/embed

Types and configuration for embeddable social media links.

Types

Apple Music embed settings.

pub type AppleMusicConfig {
  AppleMusicConfig(
    width: option.Option(Int),
    height: option.Option(Int),
    song_height: option.Option(Int),
  )
}

Constructors

Apple Music media types.

pub type AppleMusicMediaType {
  AppleMusicAlbum
  AppleMusicArtist
  AppleMusicPlaylist
  AppleMusicSong(track_id: String)
  AppleMusicMusicVideo
}

Constructors

  • AppleMusicAlbum
  • AppleMusicArtist
  • AppleMusicPlaylist
  • AppleMusicSong(track_id: String)
  • AppleMusicMusicVideo

Bluesky embed settings.

The optional resolve_handle function converts a Bluesky handle (e.g. "user.bsky.social") to a DID for richer embed rendering.

pub type BlueskyConfig {
  BlueskyConfig(
    resolve_handle: option.Option(
      fn(String) -> Result(String, Nil),
    ),
  )
}

Constructors

  • BlueskyConfig(
      resolve_handle: option.Option(fn(String) -> Result(String, Nil)),
    )

Configuration controlling which providers are enabled and their settings.

Each field is an Option: Some(config) enables the provider with the given settings, None disables it. Providers with no configuration options (Twitter, TikTok, Instagram) use Option(Nil).

Use default_config() for sensible defaults or new() to start with all providers disabled and opt in selectively.

pub type Config {
  Config(
    youtube: option.Option(YoutubeConfig),
    vimeo: option.Option(VimeoConfig),
    spotify: option.Option(SpotifyConfig),
    twitter: option.Option(Nil),
    tiktok: option.Option(Nil),
    bluesky: option.Option(BlueskyConfig),
    instagram: option.Option(Nil),
    twitch: option.Option(TwitchConfig),
    openstreetmap: option.Option(OpenStreetMapConfig),
    ted: option.Option(TedConfig),
    soundcloud: option.Option(SoundCloudConfig),
    mastodon: option.Option(MastodonConfig),
    pixelfed: option.Option(PixelfedConfig),
    apple_music: option.Option(AppleMusicConfig),
  )
}

Constructors

A detected embeddable social media link.

Each variant holds the data extracted from a URL, sufficient to render the embed as HTML. Create values with inlay.detect or inlay.detect_with.

pub type Embed {
  YoutubeVideo(
    id: String,
    start_time: option.Option(Int),
    playlist: option.Option(String),
  )
  YoutubePlaylist(id: String)
  VimeoVideo(id: String, privacy_hash: option.Option(String))
  SpotifyMedia(media_type: SpotifyMediaType, id: String)
  Tweet(handle: String, id: String)
  TikTokVideo(username: String, id: String)
  BlueskyPost(handle: String, rkey: String)
  InstagramPost(post_type: InstagramPostType, id: String)
  TwitchChannel(name: String)
  TwitchVideo(id: String)
  MapLocation(zoom: Int, lat: Float, long: Float)
  TedTalk(slug: String)
  SoundCloudTrack(path: String)
  MastodonPost(server: String, user: String, id: String)
  PixelfedPost(server: String, user: String, id: String)
  AppleMusicMedia(
    media_type: AppleMusicMediaType,
    country: String,
    slug: String,
    id: String,
  )
}

Constructors

  • YoutubeVideo(
      id: String,
      start_time: option.Option(Int),
      playlist: option.Option(String),
    )
  • YoutubePlaylist(id: String)
  • VimeoVideo(id: String, privacy_hash: option.Option(String))
  • SpotifyMedia(media_type: SpotifyMediaType, id: String)
  • Tweet(handle: String, id: String)
  • TikTokVideo(username: String, id: String)
  • BlueskyPost(handle: String, rkey: String)
  • InstagramPost(post_type: InstagramPostType, id: String)
  • TwitchChannel(name: String)
  • TwitchVideo(id: String)
  • MapLocation(zoom: Int, lat: Float, long: Float)
  • TedTalk(slug: String)
  • SoundCloudTrack(path: String)
  • MastodonPost(server: String, user: String, id: String)
  • PixelfedPost(server: String, user: String, id: String)
  • AppleMusicMedia(
      media_type: AppleMusicMediaType,
      country: String,
      slug: String,
      id: String,
    )

Instagram post types.

pub type InstagramPostType {
  Post
  Reel
  TV
}

Constructors

  • Post
  • Reel
  • TV

Mastodon embed settings. Only posts from listed servers are detected.

pub type MastodonConfig {
  MastodonConfig(
    servers: List(String),
    width: option.Option(Int),
  )
}

Constructors

  • MastodonConfig(servers: List(String), width: option.Option(Int))

OpenStreetMap embed settings.

pub type OpenStreetMapConfig {
  OpenStreetMapConfig(aspect_ratio: option.Option(String))
}

Constructors

Pixelfed embed settings. Only posts from listed servers are detected.

pub type PixelfedConfig {
  PixelfedConfig(
    servers: List(String),
    layout: PixelfedLayout,
    width: option.Option(Int),
  )
}

Constructors

Pixelfed embed layout.

pub type PixelfedLayout {
  Full(caption: Bool, likes: Bool)
  Compact
}

Constructors

  • Full(caption: Bool, likes: Bool)
  • Compact

SoundCloud embed settings.

pub type SoundCloudConfig {
  SoundCloudConfig(
    width: option.Option(Int),
    height: option.Option(Int),
  )
}

Constructors

Spotify embed settings.

pub type SpotifyConfig {
  SpotifyConfig(
    width: option.Option(Int),
    height: option.Option(Int),
    track_height: option.Option(Int),
  )
}

Constructors

Spotify media types.

pub type SpotifyMediaType {
  SpotifyPlaylist
  SpotifyTrack
  SpotifyAlbum
  SpotifyArtist
  SpotifyEpisode
  SpotifyShow
}

Constructors

  • SpotifyPlaylist
  • SpotifyTrack
  • SpotifyAlbum
  • SpotifyArtist
  • SpotifyEpisode
  • SpotifyShow

TED talk embed settings.

pub type TedConfig {
  TedConfig(aspect_ratio: option.Option(String))
}

Constructors

Twitch embed settings. The parent domain is required by Twitch’s embed API.

pub type TwitchConfig {
  TwitchConfig(
    parent: String,
    aspect_ratio: option.Option(String),
  )
}

Constructors

  • TwitchConfig(parent: String, aspect_ratio: option.Option(String))

Vimeo embed settings.

pub type VimeoConfig {
  VimeoConfig(dnt: Bool, aspect_ratio: option.Option(String))
}

Constructors

YouTube embed settings.

pub type YoutubeConfig {
  YoutubeConfig(
    no_cookie: Bool,
    aspect_ratio: option.Option(String),
  )
}

Constructors

  • YoutubeConfig(
      no_cookie: Bool,
      aspect_ratio: option.Option(String),
    )

Values

pub fn apple_music_config() -> AppleMusicConfig

Create a default Apple Music configuration.

pub fn bluesky_config() -> BlueskyConfig

Create a default Bluesky configuration with no handle resolver.

pub fn default_config() -> Config

Create a default configuration with commonly used providers enabled.

Enabled: YouTube, Vimeo, Spotify, Twitter/X, TikTok, Bluesky, Instagram, OpenStreetMap, TED, SoundCloud, Apple Music.

Disabled (require explicit setup): Twitch, Mastodon, Pixelfed.

pub fn mastodon_config(servers: List(String)) -> MastodonConfig

Create a Mastodon configuration for the given server allowlist.

pub fn new() -> Config

Create an empty configuration with all providers disabled. Enable providers selectively with the builder functions in the inlay module.

pub fn openstreetmap_config() -> OpenStreetMapConfig

Create a default OpenStreetMap configuration.

pub fn pixelfed_config(
  servers: List(String),
  layout: PixelfedLayout,
) -> PixelfedConfig

Create a Pixelfed configuration for the given server allowlist and layout.

pub fn soundcloud_config() -> SoundCloudConfig

Create a default SoundCloud configuration.

pub fn spotify_config() -> SpotifyConfig

Create a default Spotify configuration.

pub fn ted_config() -> TedConfig

Create a default TED configuration.

pub fn twitch_config(parent: String) -> TwitchConfig

Create a Twitch configuration with the required parent domain.

pub fn vimeo_config() -> VimeoConfig

Create a default Vimeo configuration with Do Not Track enabled.

pub fn youtube_config() -> YoutubeConfig

Create a default YouTube configuration with privacy-enhanced mode enabled.

Search Document