Command line client for Write.as https://write.as/apps/cli
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

553 lines
19 KiB

  1. // Copyright (c) 2014, David Kitchen <david@buro9.com>
  2. //
  3. // All rights reserved.
  4. //
  5. // Redistribution and use in source and binary forms, with or without
  6. // modification, are permitted provided that the following conditions are met:
  7. //
  8. // * Redistributions of source code must retain the above copyright notice, this
  9. // list of conditions and the following disclaimer.
  10. //
  11. // * Redistributions in binary form must reproduce the above copyright notice,
  12. // this list of conditions and the following disclaimer in the documentation
  13. // and/or other materials provided with the distribution.
  14. //
  15. // * Neither the name of the organisation (Microcosm) nor the names of its
  16. // contributors may be used to endorse or promote products derived from
  17. // this software without specific prior written permission.
  18. //
  19. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  20. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21. // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  22. // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  23. // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  24. // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  25. // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  26. // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  27. // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  28. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. package bluemonday
  30. import (
  31. "net/url"
  32. "regexp"
  33. "strings"
  34. )
  35. // Policy encapsulates the whitelist of HTML elements and attributes that will
  36. // be applied to the sanitised HTML.
  37. //
  38. // You should use bluemonday.NewPolicy() to create a blank policy as the
  39. // unexported fields contain maps that need to be initialized.
  40. type Policy struct {
  41. // Declares whether the maps have been initialized, used as a cheap check to
  42. // ensure that those using Policy{} directly won't cause nil pointer
  43. // exceptions
  44. initialized bool
  45. // If true then we add spaces when stripping tags, specifically the closing
  46. // tag is replaced by a space character.
  47. addSpaces bool
  48. // When true, add rel="nofollow" to HTML anchors
  49. requireNoFollow bool
  50. // When true, add rel="nofollow" to HTML anchors
  51. // Will add for href="http://foo"
  52. // Will skip for href="/foo" or href="foo"
  53. requireNoFollowFullyQualifiedLinks bool
  54. // When true add target="_blank" to fully qualified links
  55. // Will add for href="http://foo"
  56. // Will skip for href="/foo" or href="foo"
  57. addTargetBlankToFullyQualifiedLinks bool
  58. // When true, URLs must be parseable by "net/url" url.Parse()
  59. requireParseableURLs bool
  60. // When true, u, _ := url.Parse("url"); !u.IsAbs() is permitted
  61. allowRelativeURLs bool
  62. // When true, allow data attributes.
  63. allowDataAttributes bool
  64. // map[htmlElementName]map[htmlAttributeName]attrPolicy
  65. elsAndAttrs map[string]map[string]attrPolicy
  66. // map[htmlAttributeName]attrPolicy
  67. globalAttrs map[string]attrPolicy
  68. // If urlPolicy is nil, all URLs with matching schema are allowed.
  69. // Otherwise, only the URLs with matching schema and urlPolicy(url)
  70. // returning true are allowed.
  71. allowURLSchemes map[string]urlPolicy
  72. // If an element has had all attributes removed as a result of a policy
  73. // being applied, then the element would be removed from the output.
  74. //
  75. // However some elements are valid and have strong layout meaning without
  76. // any attributes, i.e. <table>. To prevent those being removed we maintain
  77. // a list of elements that are allowed to have no attributes and that will
  78. // be maintained in the output HTML.
  79. setOfElementsAllowedWithoutAttrs map[string]struct{}
  80. setOfElementsToSkipContent map[string]struct{}
  81. }
  82. type attrPolicy struct {
  83. // optional pattern to match, when not nil the regexp needs to match
  84. // otherwise the attribute is removed
  85. regexp *regexp.Regexp
  86. }
  87. type attrPolicyBuilder struct {
  88. p *Policy
  89. attrNames []string
  90. regexp *regexp.Regexp
  91. allowEmpty bool
  92. }
  93. type urlPolicy func(url *url.URL) (allowUrl bool)
  94. // init initializes the maps if this has not been done already
  95. func (p *Policy) init() {
  96. if !p.initialized {
  97. p.elsAndAttrs = make(map[string]map[string]attrPolicy)
  98. p.globalAttrs = make(map[string]attrPolicy)
  99. p.allowURLSchemes = make(map[string]urlPolicy)
  100. p.setOfElementsAllowedWithoutAttrs = make(map[string]struct{})
  101. p.setOfElementsToSkipContent = make(map[string]struct{})
  102. p.initialized = true
  103. }
  104. }
  105. // NewPolicy returns a blank policy with nothing whitelisted or permitted. This
  106. // is the recommended way to start building a policy and you should now use
  107. // AllowAttrs() and/or AllowElements() to construct the whitelist of HTML
  108. // elements and attributes.
  109. func NewPolicy() *Policy {
  110. p := Policy{}
  111. p.addDefaultElementsWithoutAttrs()
  112. p.addDefaultSkipElementContent()
  113. return &p
  114. }
  115. // AllowAttrs takes a range of HTML attribute names and returns an
  116. // attribute policy builder that allows you to specify the pattern and scope of
  117. // the whitelisted attribute.
  118. //
  119. // The attribute policy is only added to the core policy when either Globally()
  120. // or OnElements(...) are called.
  121. func (p *Policy) AllowAttrs(attrNames ...string) *attrPolicyBuilder {
  122. p.init()
  123. abp := attrPolicyBuilder{
  124. p: p,
  125. allowEmpty: false,
  126. }
  127. for _, attrName := range attrNames {
  128. abp.attrNames = append(abp.attrNames, strings.ToLower(attrName))
  129. }
  130. return &abp
  131. }
  132. // AllowDataAttributes whitelists all data attributes. We can't specify the name
  133. // of each attribute exactly as they are customized.
  134. //
  135. // NOTE: These values are not sanitized and applications that evaluate or process
  136. // them without checking and verification of the input may be at risk if this option
  137. // is enabled. This is a 'caveat emptor' option and the person enabling this option
  138. // needs to fully understand the potential impact with regards to whatever application
  139. // will be consuming the sanitized HTML afterwards, i.e. if you know you put a link in a
  140. // data attribute and use that to automatically load some new window then you're giving
  141. // the author of a HTML fragment the means to open a malicious destination automatically.
  142. // Use with care!
  143. func (p *Policy) AllowDataAttributes() {
  144. p.allowDataAttributes = true
  145. }
  146. // AllowNoAttrs says that attributes on element are optional.
  147. //
  148. // The attribute policy is only added to the core policy when OnElements(...)
  149. // are called.
  150. func (p *Policy) AllowNoAttrs() *attrPolicyBuilder {
  151. p.init()
  152. abp := attrPolicyBuilder{
  153. p: p,
  154. allowEmpty: true,
  155. }
  156. return &abp
  157. }
  158. // AllowNoAttrs says that attributes on element are optional.
  159. //
  160. // The attribute policy is only added to the core policy when OnElements(...)
  161. // are called.
  162. func (abp *attrPolicyBuilder) AllowNoAttrs() *attrPolicyBuilder {
  163. abp.allowEmpty = true
  164. return abp
  165. }
  166. // Matching allows a regular expression to be applied to a nascent attribute
  167. // policy, and returns the attribute policy. Calling this more than once will
  168. // replace the existing regexp.
  169. func (abp *attrPolicyBuilder) Matching(regex *regexp.Regexp) *attrPolicyBuilder {
  170. abp.regexp = regex
  171. return abp
  172. }
  173. // OnElements will bind an attribute policy to a given range of HTML elements
  174. // and return the updated policy
  175. func (abp *attrPolicyBuilder) OnElements(elements ...string) *Policy {
  176. for _, element := range elements {
  177. element = strings.ToLower(element)
  178. for _, attr := range abp.attrNames {
  179. if _, ok := abp.p.elsAndAttrs[element]; !ok {
  180. abp.p.elsAndAttrs[element] = make(map[string]attrPolicy)
  181. }
  182. ap := attrPolicy{}
  183. if abp.regexp != nil {
  184. ap.regexp = abp.regexp
  185. }
  186. abp.p.elsAndAttrs[element][attr] = ap
  187. }
  188. if abp.allowEmpty {
  189. abp.p.setOfElementsAllowedWithoutAttrs[element] = struct{}{}
  190. if _, ok := abp.p.elsAndAttrs[element]; !ok {
  191. abp.p.elsAndAttrs[element] = make(map[string]attrPolicy)
  192. }
  193. }
  194. }
  195. return abp.p
  196. }
  197. // Globally will bind an attribute policy to all HTML elements and return the
  198. // updated policy
  199. func (abp *attrPolicyBuilder) Globally() *Policy {
  200. for _, attr := range abp.attrNames {
  201. if _, ok := abp.p.globalAttrs[attr]; !ok {
  202. abp.p.globalAttrs[attr] = attrPolicy{}
  203. }
  204. ap := attrPolicy{}
  205. if abp.regexp != nil {
  206. ap.regexp = abp.regexp
  207. }
  208. abp.p.globalAttrs[attr] = ap
  209. }
  210. return abp.p
  211. }
  212. // AllowElements will append HTML elements to the whitelist without applying an
  213. // attribute policy to those elements (the elements are permitted
  214. // sans-attributes)
  215. func (p *Policy) AllowElements(names ...string) *Policy {
  216. p.init()
  217. for _, element := range names {
  218. element = strings.ToLower(element)
  219. if _, ok := p.elsAndAttrs[element]; !ok {
  220. p.elsAndAttrs[element] = make(map[string]attrPolicy)
  221. }
  222. }
  223. return p
  224. }
  225. // RequireNoFollowOnLinks will result in all <a> tags having a rel="nofollow"
  226. // added to them if one does not already exist
  227. //
  228. // Note: This requires p.RequireParseableURLs(true) and will enable it.
  229. func (p *Policy) RequireNoFollowOnLinks(require bool) *Policy {
  230. p.requireNoFollow = require
  231. p.requireParseableURLs = true
  232. return p
  233. }
  234. // RequireNoFollowOnFullyQualifiedLinks will result in all <a> tags that point
  235. // to a non-local destination (i.e. starts with a protocol and has a host)
  236. // having a rel="nofollow" added to them if one does not already exist
  237. //
  238. // Note: This requires p.RequireParseableURLs(true) and will enable it.
  239. func (p *Policy) RequireNoFollowOnFullyQualifiedLinks(require bool) *Policy {
  240. p.requireNoFollowFullyQualifiedLinks = require
  241. p.requireParseableURLs = true
  242. return p
  243. }
  244. // AddTargetBlankToFullyQualifiedLinks will result in all <a> tags that point
  245. // to a non-local destination (i.e. starts with a protocol and has a host)
  246. // having a target="_blank" added to them if one does not already exist
  247. //
  248. // Note: This requires p.RequireParseableURLs(true) and will enable it.
  249. func (p *Policy) AddTargetBlankToFullyQualifiedLinks(require bool) *Policy {
  250. p.addTargetBlankToFullyQualifiedLinks = require
  251. p.requireParseableURLs = true
  252. return p
  253. }
  254. // RequireParseableURLs will result in all URLs requiring that they be parseable
  255. // by "net/url" url.Parse()
  256. // This applies to:
  257. // - a.href
  258. // - area.href
  259. // - blockquote.cite
  260. // - img.src
  261. // - link.href
  262. // - script.src
  263. func (p *Policy) RequireParseableURLs(require bool) *Policy {
  264. p.requireParseableURLs = require
  265. return p
  266. }
  267. // AllowRelativeURLs enables RequireParseableURLs and then permits URLs that
  268. // are parseable, have no schema information and url.IsAbs() returns false
  269. // This permits local URLs
  270. func (p *Policy) AllowRelativeURLs(require bool) *Policy {
  271. p.RequireParseableURLs(true)
  272. p.allowRelativeURLs = require
  273. return p
  274. }
  275. // AllowURLSchemes will append URL schemes to the whitelist
  276. // Example: p.AllowURLSchemes("mailto", "http", "https")
  277. func (p *Policy) AllowURLSchemes(schemes ...string) *Policy {
  278. p.init()
  279. p.RequireParseableURLs(true)
  280. for _, scheme := range schemes {
  281. scheme = strings.ToLower(scheme)
  282. // Allow all URLs with matching scheme.
  283. p.allowURLSchemes[scheme] = nil
  284. }
  285. return p
  286. }
  287. // AllowURLSchemeWithCustomPolicy will append URL schemes with
  288. // a custom URL policy to the whitelist.
  289. // Only the URLs with matching schema and urlPolicy(url)
  290. // returning true will be allowed.
  291. func (p *Policy) AllowURLSchemeWithCustomPolicy(
  292. scheme string,
  293. urlPolicy func(url *url.URL) (allowUrl bool),
  294. ) *Policy {
  295. p.init()
  296. p.RequireParseableURLs(true)
  297. scheme = strings.ToLower(scheme)
  298. p.allowURLSchemes[scheme] = urlPolicy
  299. return p
  300. }
  301. // AddSpaceWhenStrippingTag states whether to add a single space " " when
  302. // removing tags that are not whitelisted by the policy.
  303. //
  304. // This is useful if you expect to strip tags in dense markup and may lose the
  305. // value of whitespace.
  306. //
  307. // For example: "<p>Hello</p><p>World</p>"" would be sanitized to "HelloWorld"
  308. // with the default value of false, but you may wish to sanitize this to
  309. // " Hello World " by setting AddSpaceWhenStrippingTag to true as this would
  310. // retain the intent of the text.
  311. func (p *Policy) AddSpaceWhenStrippingTag(allow bool) *Policy {
  312. p.addSpaces = allow
  313. return p
  314. }
  315. // SkipElementsContent adds the HTML elements whose tags is needed to be removed
  316. // with its content.
  317. func (p *Policy) SkipElementsContent(names ...string) *Policy {
  318. p.init()
  319. for _, element := range names {
  320. element = strings.ToLower(element)
  321. if _, ok := p.setOfElementsToSkipContent[element]; !ok {
  322. p.setOfElementsToSkipContent[element] = struct{}{}
  323. }
  324. }
  325. return p
  326. }
  327. // AllowElementsContent marks the HTML elements whose content should be
  328. // retained after removing the tag.
  329. func (p *Policy) AllowElementsContent(names ...string) *Policy {
  330. p.init()
  331. for _, element := range names {
  332. delete(p.setOfElementsToSkipContent, strings.ToLower(element))
  333. }
  334. return p
  335. }
  336. // addDefaultElementsWithoutAttrs adds the HTML elements that we know are valid
  337. // without any attributes to an internal map.
  338. // i.e. we know that <table> is valid, but <bdo> isn't valid as the "dir" attr
  339. // is mandatory
  340. func (p *Policy) addDefaultElementsWithoutAttrs() {
  341. p.init()
  342. p.setOfElementsAllowedWithoutAttrs["abbr"] = struct{}{}
  343. p.setOfElementsAllowedWithoutAttrs["acronym"] = struct{}{}
  344. p.setOfElementsAllowedWithoutAttrs["address"] = struct{}{}
  345. p.setOfElementsAllowedWithoutAttrs["article"] = struct{}{}
  346. p.setOfElementsAllowedWithoutAttrs["aside"] = struct{}{}
  347. p.setOfElementsAllowedWithoutAttrs["audio"] = struct{}{}
  348. p.setOfElementsAllowedWithoutAttrs["b"] = struct{}{}
  349. p.setOfElementsAllowedWithoutAttrs["bdi"] = struct{}{}
  350. p.setOfElementsAllowedWithoutAttrs["blockquote"] = struct{}{}
  351. p.setOfElementsAllowedWithoutAttrs["body"] = struct{}{}
  352. p.setOfElementsAllowedWithoutAttrs["br"] = struct{}{}
  353. p.setOfElementsAllowedWithoutAttrs["button"] = struct{}{}
  354. p.setOfElementsAllowedWithoutAttrs["canvas"] = struct{}{}
  355. p.setOfElementsAllowedWithoutAttrs["caption"] = struct{}{}
  356. p.setOfElementsAllowedWithoutAttrs["center"] = struct{}{}
  357. p.setOfElementsAllowedWithoutAttrs["cite"] = struct{}{}
  358. p.setOfElementsAllowedWithoutAttrs["code"] = struct{}{}
  359. p.setOfElementsAllowedWithoutAttrs["col"] = struct{}{}
  360. p.setOfElementsAllowedWithoutAttrs["colgroup"] = struct{}{}
  361. p.setOfElementsAllowedWithoutAttrs["datalist"] = struct{}{}
  362. p.setOfElementsAllowedWithoutAttrs["dd"] = struct{}{}
  363. p.setOfElementsAllowedWithoutAttrs["del"] = struct{}{}
  364. p.setOfElementsAllowedWithoutAttrs["details"] = struct{}{}
  365. p.setOfElementsAllowedWithoutAttrs["dfn"] = struct{}{}
  366. p.setOfElementsAllowedWithoutAttrs["div"] = struct{}{}
  367. p.setOfElementsAllowedWithoutAttrs["dl"] = struct{}{}
  368. p.setOfElementsAllowedWithoutAttrs["dt"] = struct{}{}
  369. p.setOfElementsAllowedWithoutAttrs["em"] = struct{}{}
  370. p.setOfElementsAllowedWithoutAttrs["fieldset"] = struct{}{}
  371. p.setOfElementsAllowedWithoutAttrs["figcaption"] = struct{}{}
  372. p.setOfElementsAllowedWithoutAttrs["figure"] = struct{}{}
  373. p.setOfElementsAllowedWithoutAttrs["footer"] = struct{}{}
  374. p.setOfElementsAllowedWithoutAttrs["h1"] = struct{}{}
  375. p.setOfElementsAllowedWithoutAttrs["h2"] = struct{}{}
  376. p.setOfElementsAllowedWithoutAttrs["h3"] = struct{}{}
  377. p.setOfElementsAllowedWithoutAttrs["h4"] = struct{}{}
  378. p.setOfElementsAllowedWithoutAttrs["h5"] = struct{}{}
  379. p.setOfElementsAllowedWithoutAttrs["h6"] = struct{}{}
  380. p.setOfElementsAllowedWithoutAttrs["head"] = struct{}{}
  381. p.setOfElementsAllowedWithoutAttrs["header"] = struct{}{}
  382. p.setOfElementsAllowedWithoutAttrs["hgroup"] = struct{}{}
  383. p.setOfElementsAllowedWithoutAttrs["hr"] = struct{}{}
  384. p.setOfElementsAllowedWithoutAttrs["html"] = struct{}{}
  385. p.setOfElementsAllowedWithoutAttrs["i"] = struct{}{}
  386. p.setOfElementsAllowedWithoutAttrs["ins"] = struct{}{}
  387. p.setOfElementsAllowedWithoutAttrs["kbd"] = struct{}{}
  388. p.setOfElementsAllowedWithoutAttrs["li"] = struct{}{}
  389. p.setOfElementsAllowedWithoutAttrs["mark"] = struct{}{}
  390. p.setOfElementsAllowedWithoutAttrs["marquee"] = struct{}{}
  391. p.setOfElementsAllowedWithoutAttrs["nav"] = struct{}{}
  392. p.setOfElementsAllowedWithoutAttrs["ol"] = struct{}{}
  393. p.setOfElementsAllowedWithoutAttrs["optgroup"] = struct{}{}
  394. p.setOfElementsAllowedWithoutAttrs["option"] = struct{}{}
  395. p.setOfElementsAllowedWithoutAttrs["p"] = struct{}{}
  396. p.setOfElementsAllowedWithoutAttrs["pre"] = struct{}{}
  397. p.setOfElementsAllowedWithoutAttrs["q"] = struct{}{}
  398. p.setOfElementsAllowedWithoutAttrs["rp"] = struct{}{}
  399. p.setOfElementsAllowedWithoutAttrs["rt"] = struct{}{}
  400. p.setOfElementsAllowedWithoutAttrs["ruby"] = struct{}{}
  401. p.setOfElementsAllowedWithoutAttrs["s"] = struct{}{}
  402. p.setOfElementsAllowedWithoutAttrs["samp"] = struct{}{}
  403. p.setOfElementsAllowedWithoutAttrs["script"] = struct{}{}
  404. p.setOfElementsAllowedWithoutAttrs["section"] = struct{}{}
  405. p.setOfElementsAllowedWithoutAttrs["select"] = struct{}{}
  406. p.setOfElementsAllowedWithoutAttrs["small"] = struct{}{}
  407. p.setOfElementsAllowedWithoutAttrs["span"] = struct{}{}
  408. p.setOfElementsAllowedWithoutAttrs["strike"] = struct{}{}
  409. p.setOfElementsAllowedWithoutAttrs["strong"] = struct{}{}
  410. p.setOfElementsAllowedWithoutAttrs["style"] = struct{}{}
  411. p.setOfElementsAllowedWithoutAttrs["sub"] = struct{}{}
  412. p.setOfElementsAllowedWithoutAttrs["summary"] = struct{}{}
  413. p.setOfElementsAllowedWithoutAttrs["sup"] = struct{}{}
  414. p.setOfElementsAllowedWithoutAttrs["svg"] = struct{}{}
  415. p.setOfElementsAllowedWithoutAttrs["table"] = struct{}{}
  416. p.setOfElementsAllowedWithoutAttrs["tbody"] = struct{}{}
  417. p.setOfElementsAllowedWithoutAttrs["td"] = struct{}{}
  418. p.setOfElementsAllowedWithoutAttrs["textarea"] = struct{}{}
  419. p.setOfElementsAllowedWithoutAttrs["tfoot"] = struct{}{}
  420. p.setOfElementsAllowedWithoutAttrs["th"] = struct{}{}
  421. p.setOfElementsAllowedWithoutAttrs["thead"] = struct{}{}
  422. p.setOfElementsAllowedWithoutAttrs["title"] = struct{}{}
  423. p.setOfElementsAllowedWithoutAttrs["time"] = struct{}{}
  424. p.setOfElementsAllowedWithoutAttrs["tr"] = struct{}{}
  425. p.setOfElementsAllowedWithoutAttrs["tt"] = struct{}{}
  426. p.setOfElementsAllowedWithoutAttrs["u"] = struct{}{}
  427. p.setOfElementsAllowedWithoutAttrs["ul"] = struct{}{}
  428. p.setOfElementsAllowedWithoutAttrs["var"] = struct{}{}
  429. p.setOfElementsAllowedWithoutAttrs["video"] = struct{}{}
  430. p.setOfElementsAllowedWithoutAttrs["wbr"] = struct{}{}
  431. }
  432. // addDefaultSkipElementContent adds the HTML elements that we should skip
  433. // rendering the character content of, if the element itself is not allowed.
  434. // This is all character data that the end user would not normally see.
  435. // i.e. if we exclude a <script> tag then we shouldn't render the JavaScript or
  436. // anything else until we encounter the closing </script> tag.
  437. func (p *Policy) addDefaultSkipElementContent() {
  438. p.init()
  439. p.setOfElementsToSkipContent["frame"] = struct{}{}
  440. p.setOfElementsToSkipContent["frameset"] = struct{}{}
  441. p.setOfElementsToSkipContent["iframe"] = struct{}{}
  442. p.setOfElementsToSkipContent["noembed"] = struct{}{}
  443. p.setOfElementsToSkipContent["noframes"] = struct{}{}
  444. p.setOfElementsToSkipContent["noscript"] = struct{}{}
  445. p.setOfElementsToSkipContent["nostyle"] = struct{}{}
  446. p.setOfElementsToSkipContent["object"] = struct{}{}
  447. p.setOfElementsToSkipContent["script"] = struct{}{}
  448. p.setOfElementsToSkipContent["style"] = struct{}{}
  449. p.setOfElementsToSkipContent["title"] = struct{}{}
  450. }