Skip to content

Commit

Permalink
feat: add the display shortcode
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Jun 27, 2023
1 parent 4cf95e8 commit 72cd00a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions layouts/partials/bootstrap/display.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- $level := 1 }}
{{- $class := "" }}
{{- if .IsNamedParams }}
{{- with .Get "level" }}{{ $level = . }}{{ end }}
{{- with .Get "class" }}{{ $class = . }}{{ end }}
{{- else }}
{{- with .Get 0 }}{{ $level = . }}{{ end }}
{{- with .Get 1 }}{{ $class = . }}{{ end }}
{{- end }}
{{- $classes := printf "display-%d" $level | slice }}
{{- with $class }}{{ $classes = $classes | append . }}{{ end }}
<h1 class="{{ delimit $classes ` ` }}">{{ .Inner }}</h1>
2 changes: 2 additions & 0 deletions layouts/shortcodes/bootstrap/display.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{{- if .Inner }}{{ end }}
{{- partial "bootstrap/display" . }}
2 changes: 2 additions & 0 deletions layouts/shortcodes/bs/display.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{{- if .Inner }}{{ end }}
{{- partial "bootstrap/display" . }}

0 comments on commit 72cd00a

Please sign in to comment.