Re-implement columns shortcode as markdown list
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
{{- $ratio := (split (.Get "ratio") ":") -}}
|
||||
{{- if strings.Contains .InnerDeindent "<--->" -}}
|
||||
{{ warnf "Columns shortcode seprator '<--->' is deprecated, use markdown list instead." -}}
|
||||
<div class="book-columns flex flex-wrap{{ with .Get "class" }} {{ . }}{{ end }}">
|
||||
{{ range $index, $content := split .InnerDeindent "<--->" }}
|
||||
{{- $grow := default 1 (index $ratio $index) -}}
|
||||
@@ -7,3 +9,13 @@
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="book-columns book-columns-{{ .Ordinal }} {{ with .Get "class" }}{{ . }}{{ end }}">
|
||||
<style>{{- range $index, $grow := $ratio -}}
|
||||
.book-columns-{{ $.Ordinal }}>ul>li:nth-child({{ $index | add 1 }}){
|
||||
flex-grow: {{ $grow }};
|
||||
}
|
||||
{{ end -}}</style>
|
||||
{{ .Inner | safeHTML }}
|
||||
</div>
|
||||
{{ end -}}
|
||||
|
||||
Reference in New Issue
Block a user