Skip to content

Commit

Permalink
feat: support video footnote
Browse files Browse the repository at this point in the history
config.toml

```toml
enableVideoHost = true
videoHostURL = "https://a.com/"
```

Markdown

```md
[^1]<video src="/videos/sunrise.mp4" ... title="Sunrise"></video>
```

or

```md
[^1]![](/videos/sunrise.mp4 "Sunrise")
```

Rendered HTML

```html
<p>
  <sup style="float:right" class="footnote-ref" id="fnref:1">
    <a href="#fn:1">[1]</a>
  </sup>
  <video src="https://a.com/videos/sunrise.mp4" controls></video>
  <span class="caption">◎ Sunrise</span>
</p>
```
  • Loading branch information
reuixiy committed Nov 24, 2019
1 parent 935c9d5 commit 8324b3d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions layouts/partials/components/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@
{{- .Scratch.Set "Content" $Content -}}
{{- end -}}

<!-- Image Footnote -->
<!-- Image & Video Footnote -->
{{- $Content := .Scratch.Get "Content" -}}
{{- $regexPatternFootnoteImage := `(<sup)(.+</sup><img)` -}}
{{- $regexPatternFootnoteImage := `(<sup)(.+</sup><(img|video))` -}}
{{- $regexReplacementFootnoteImage := `$1 style="float:right"$2` -}}
{{- $Content := $Content | replaceRE $regexPatternFootnoteImage $regexReplacementFootnoteImage | safeHTML -}}
{{- .Scratch.Set "Content" $Content -}}
Expand Down Expand Up @@ -135,7 +135,7 @@
{{- $Content := $Content | replaceRE $regexPatternVideo $regexReplacementVideo | safeHTML -}}
{{- .Scratch.Set "Content" $Content -}}

<!-- Image / Video Caption -->
<!-- Image & Video Caption -->
{{- $Content := .Scratch.Get "Content" -}}
{{- if .Site.Params.enableCaption -}}
{{- $captionPrefix := .Site.Params.captionPrefix -}}
Expand Down

0 comments on commit 8324b3d

Please sign in to comment.