MCPcopy Index your code
hub / github.com/writefreely/writefreely / disableYoutubeAutoplay

Function disableYoutubeAutoplay

postrender.go:126–143  ·  view source on GitHub ↗
(outHTML string)

Source from the content-addressed store, hash-verified

124}
125
126func disableYoutubeAutoplay(outHTML string) string {
127 for _, match := range youtubeReg.FindAllString(outHTML, -1) {
128 u, err := url.Parse(match)
129 if err != nil {
130 continue
131 }
132 u.RawQuery = html.UnescapeString(u.RawQuery)
133 q := u.Query()
134 // Set Youtube autoplay url parameter, if any, to 0
135 if len(q["autoplay"]) == 1 {
136 q.Set("autoplay", "0")
137 }
138 u.RawQuery = q.Encode()
139 cleanURL := u.String()
140 outHTML = strings.Replace(outHTML, match, cleanURL, 1)
141 }
142 return outHTML
143}
144
145func applyMarkdownSpecial(data []byte, baseURL string, cfg *config.Config, skipNoFollow bool) string {
146 mdExtensions := 0 |

Callers 1

applyMarkdownSpecialFunction · 0.85

Calls 1

StringMethod · 0.80

Tested by

no test coverage detected