diff --git a/modules/wowchemy-tailwind/assets/css/styles.css b/modules/wowchemy-tailwind/assets/css/styles.css index 374ee7df..c89c5da5 100644 --- a/modules/wowchemy-tailwind/assets/css/styles.css +++ b/modules/wowchemy-tailwind/assets/css/styles.css @@ -4,3 +4,4 @@ /*! Wowchemy Components | https://wowchemy.com */ @import "./components/all.css"; @import "./blocks/all.css"; +@import "themes/default.css"; diff --git a/modules/wowchemy-tailwind/assets/css/themes/default.css b/modules/wowchemy-tailwind/assets/css/themes/default.css new file mode 100644 index 00000000..f2aab9f5 --- /dev/null +++ b/modules/wowchemy-tailwind/assets/css/themes/default.css @@ -0,0 +1,26 @@ +/* Default Wowchemy color theme */ +:root { + /* Neutral */ + --color-neutral: 255, 255, 255; + --color-neutral-50: 248, 250, 252; + --color-neutral-100: 241, 245, 249; + --color-neutral-200: 226, 232, 240; + --color-neutral-300: 203, 213, 225; + --color-neutral-400: 148, 163, 184; + --color-neutral-500: 100, 116, 139; + --color-neutral-600: 71, 85, 105; + --color-neutral-700: 51, 65, 85; + --color-neutral-800: 30, 41, 59; + --color-neutral-900: 15, 23, 42; + /* Primary */ + --color-primary-50: 239, 246, 255; + --color-primary-100: 219, 234, 254; + --color-primary-200: 191, 219, 254; + --color-primary-300: 147, 197, 253; + --color-primary-400: 96, 165, 250; + --color-primary-500: 59, 130, 246; + --color-primary-600: 37, 99, 235; + --color-primary-700: 29, 78, 216; + --color-primary-800: 30, 64, 175; + --color-primary-900: 30, 58, 138; +} diff --git a/modules/wowchemy-tailwind/data/icons.yaml b/modules/wowchemy-tailwind/data/icons.yaml index edb43908..e4b69392 100644 --- a/modules/wowchemy-tailwind/data/icons.yaml +++ b/modules/wowchemy-tailwind/data/icons.yaml @@ -26,3 +26,15 @@ send: + +# Callouts +information-circle: + + +exclamation-triangle: + + + +# Skills + +python: diff --git a/modules/wowchemy-tailwind/layouts/partials/social_links.html b/modules/wowchemy-tailwind/layouts/partials/social_links.html index 81786e32..c0c528be 100644 --- a/modules/wowchemy-tailwind/layouts/partials/social_links.html +++ b/modules/wowchemy-tailwind/layouts/partials/social_links.html @@ -15,7 +15,7 @@ href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }} aria-label="{{ .icon | title }}" - >{{ partial "functions/get_icon" (dict "name" .icon "attributes" "height=\"1em\"") }} + >{{ partial "functions/get_icon" (dict "name" .icon "attributes" "style=\"height: 1em;\"") }} {{ end }} {{ end }} diff --git a/modules/wowchemy-tailwind/layouts/shortcodes/audio.html b/modules/wowchemy-tailwind/layouts/shortcodes/audio.html new file mode 100644 index 00000000..85f4dda0 --- /dev/null +++ b/modules/wowchemy-tailwind/layouts/shortcodes/audio.html @@ -0,0 +1,41 @@ +{{/* Audio Shortcode for Wowchemy. */}} +{{/* Load audio from page dir falling back to media library at `assets/media/` and then to remote URI. */}} +{{/* Supports primarily MP3 and MP4. */}} + +{{/* + Docs: https://wowchemy.com/docs/content/writing-markdown-latex/#audio + + Parameters + ---------- + src : + Path to file or url for the audio file. + If a local file, first it is searched in the page directory, and then in `assets/media/` . + id : optional + Custom id "audio-{id}" to associate to the tag. +*/}} + +{{ $destination := .Get "src" }} +{{ $is_remote := strings.HasPrefix $destination "http" }} +{{- $asset := "" -}} +{{- if not $is_remote -}} + {{- $asset = (.Page.Resources.ByType "audio").GetMatch $destination -}} + {{- if not $asset -}} + {{- $asset = resources.Get (path.Join "media" $destination) -}} + {{- end -}} +{{- end -}} + +{{ if $asset }} + {{ $destination = $asset.RelPermalink }} +{{ else }} + {{ $destination = $destination | safeURL }} +{{ end }} + + +{{ $audio_type := strings.TrimPrefix "." (path.Ext $destination) | lower }} + +{{/* Set MP3 mime type to mpeg. */}} +{{ $audio_type = replace $audio_type "mp3" "mpeg" }} + + + + diff --git a/modules/wowchemy-tailwind/layouts/shortcodes/bilibili.html b/modules/wowchemy-tailwind/layouts/shortcodes/bilibili.html new file mode 100644 index 00000000..8ce21ff1 --- /dev/null +++ b/modules/wowchemy-tailwind/layouts/shortcodes/bilibili.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/wowchemy-tailwind/layouts/shortcodes/callout.html b/modules/wowchemy-tailwind/layouts/shortcodes/callout.html new file mode 100644 index 00000000..8a024df7 --- /dev/null +++ b/modules/wowchemy-tailwind/layouts/shortcodes/callout.html @@ -0,0 +1,28 @@ +{{/* + Docs: https://university.wowchemy.com/reference/markdown/#callouts + + Parameters + ---------- + #0 : optional, positional + Name of the icon to display in the callout component. + Default Wowchemy available options include "note" and "warning". + Otherwise, you can add your own icon to assets/media/icons/ and reference its name when calling the shortcode. +*/}} +{{ $icon := "information-circle" }} +{{ with (.Get 0) }} + {{ if eq . "note" }} + {{ $icon = "information-circle" }} + {{ else if eq . "warning" }} + {{ $icon = "triangle-exclamation" }} + {{ else }} + {{ $icon = . }} + {{end}} +{{end}} + + + {{ partial "functions/get_icon" (dict "name" $icon "attributes" "height=\"24\"") }} + + + {{- .Inner | markdownify | emojify -}} + + \ No newline at end of file diff --git a/modules/wowchemy-tailwind/layouts/shortcodes/icon.html b/modules/wowchemy-tailwind/layouts/shortcodes/icon.html new file mode 100644 index 00000000..429b2362 --- /dev/null +++ b/modules/wowchemy-tailwind/layouts/shortcodes/icon.html @@ -0,0 +1,20 @@ +{{/* + Docs: https://university.wowchemy.com/reference/markdown/#inline-image + + Parameters + ---------- + name : + Icon name. + padding_left : default "0" + Left padding. + padding_right : default "1" + Right padding. +*/}} + +{{- if (.Get "name") -}} + {{- $icon := .Get "name" -}} + {{- $padding_right := (.Get "padding_right") | default 1 -}}{{/* Defaulting to 1 prevents no spacing when minimizing HTML. */}} + + {{ partial "functions/get_icon" (dict "name" $icon "attributes" "style=\"height: 1em; transform: translateY(0.1em);\"") }} + +{{- end -}} \ No newline at end of file diff --git a/modules/wowchemy-tailwind/layouts/shortcodes/mention.html b/modules/wowchemy-tailwind/layouts/shortcodes/mention.html new file mode 100644 index 00000000..f97374df --- /dev/null +++ b/modules/wowchemy-tailwind/layouts/shortcodes/mention.html @@ -0,0 +1,19 @@ +{{/* + Docs: https://wowchemy.com/docs/content/writing-markdown-latex/#mention-a-user + + Parameters + ---------- + #0 : positional + User account in Wowchemy to mention. +*/}} + +{{- $username := .Get 0 -}} +{{- $username_url := $username | urlize -}} +{{- $taxonomy := "authors" -}} +{{- $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $username_url) -}} +{{- $name := $profile_page.Title | default ($username|markdownify) -}} +{{- with $profile_page -}} + {{$name}} +{{- else -}} + {{- $name -}} +{{- end -}} diff --git a/modules/wowchemy-tailwind/layouts/shortcodes/spoiler.html b/modules/wowchemy-tailwind/layouts/shortcodes/spoiler.html new file mode 100644 index 00000000..0cb6eca5 --- /dev/null +++ b/modules/wowchemy-tailwind/layouts/shortcodes/spoiler.html @@ -0,0 +1,19 @@ +{{/* + Docs: https://wowchemy.com/docs/content/writing-markdown-latex/#toggle-list + + Parameters + ---------- + text : + Spoiler title. + class : optional + Additional class for tag. + style : optional + Additional style for tag. +*/}} + +{{- $id := printf "spoiler-%d" .Ordinal -}} + + + {{ .Get "text" | markdownify | emojify }} + {{ .Inner | markdownify | emojify }} + \ No newline at end of file diff --git a/modules/wowchemy-tailwind/layouts/shortcodes/video.html b/modules/wowchemy-tailwind/layouts/shortcodes/video.html new file mode 100644 index 00000000..7cafb7a3 --- /dev/null +++ b/modules/wowchemy-tailwind/layouts/shortcodes/video.html @@ -0,0 +1,53 @@ +{{/* Video Shortcode for Wowchemy. */}} +{{/* Load video from page dir falling back to media library at `assets/media/` and then to remote URI. */}} + +{{/* + Docs: https://wowchemy.com/docs/content/writing-markdown-latex/#videos + + Parameters + ---------- + src : + Path to file or url for the video file. + If a local file, first it is searched in the page directory, and then in `assets/media/` . + poster : optional + Path or url for the preview image. + Defaults to {src without file extension}.jpg . + If not found, defaults to "". + controls : optional + If present, display video controls, otherwise the video is set to autoplay. + id : optional + Custom id "video-{id}" to associate to the tag. +*/}} + +{{ $destination := .Get "src" }} +{{ $video_ext_with_dot := path.Ext (.Get "src") }} +{{ $video_ext := strings.TrimPrefix "." $video_ext_with_dot }} +{{ $video_type := $video_ext }} +{{ $destination_preview := (.Get "poster") | default (replace $destination $video_ext_with_dot ".jpg") }} +{{ $is_remote := strings.HasPrefix $destination "http" }} +{{- $asset := "" -}} +{{- $asset_preview := "" -}} +{{- if not $is_remote -}} + {{- $asset = (.Page.Resources.ByType "video").GetMatch $destination -}} + {{- $asset_preview = (.Page.Resources.ByType "image").GetMatch $destination_preview -}} + {{- if not $asset -}} + {{- $asset = resources.Get (path.Join "media" $destination) -}} + {{- $asset_preview = resources.Get (path.Join "media" $destination_preview) -}} + {{- end -}} + {{ $video_type = $asset.MediaType.SubType }} +{{- end -}} + +{{ if $asset }} + {{ $destination = $asset.RelPermalink }} +{{ else }} + {{ $destination = $destination | safeURL }} +{{ end }} + +{{ $poster := (.Get "poster") | default "" }} +{{ if $asset_preview }} + {{ $poster = $asset_preview.RelPermalink }} +{{ end }} + + + + diff --git a/modules/wowchemy-tailwind/tailwind.config.js b/modules/wowchemy-tailwind/tailwind.config.js index 00e2826a..189a32c3 100644 --- a/modules/wowchemy-tailwind/tailwind.config.js +++ b/modules/wowchemy-tailwind/tailwind.config.js @@ -6,10 +6,38 @@ module.exports = { require('@tailwindcss/typography'), ], safelist: [ - 'task-list', + 'task-list', /* As it's added via JS */ ], darkMode: ['class'], theme: { + colors: { + transparent: "transparent", + neutral: { + DEFAULT: "rgba(var(--color-neutral), )", + 50: "rgba(var(--color-neutral-50), )", + 100: "rgba(var(--color-neutral-100), )", + 200: "rgba(var(--color-neutral-200), )", + 300: "rgba(var(--color-neutral-300), )", + 400: "rgba(var(--color-neutral-400), )", + 500: "rgba(var(--color-neutral-500), )", + 600: "rgba(var(--color-neutral-600), )", + 700: "rgba(var(--color-neutral-700), )", + 800: "rgba(var(--color-neutral-800), )", + 900: "rgba(var(--color-neutral-900), )", + }, + primary: { + 50: "rgba(var(--color-primary-50), )", + 100: "rgba(var(--color-primary-100), )", + 200: "rgba(var(--color-primary-200), )", + 300: "rgba(var(--color-primary-300), )", + 400: "rgba(var(--color-primary-400), )", + 500: "rgba(var(--color-primary-500), )", + 600: "rgba(var(--color-primary-600), )", + 700: "rgba(var(--color-primary-700), )", + 800: "rgba(var(--color-primary-800), )", + 900: "rgba(var(--color-primary-900), )", + }, + }, extend: { fontFamily: { 'sans': ['"Inter var"', ...defaultTheme.fontFamily.sans],
{{ .Inner | markdownify | emojify }}