Browse Source

Document risk of adding infinite extensions when using global marked instance (#3702)

Document risk of adding infinite extensions when using global marked instance.

Resolves #3701
Maddy Guthridge 2 tháng trước cách đây
mục cha
commit
045ca84cfe
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  1. 2 0
      docs/USING_PRO.md

+ 2 - 0
docs/USING_PRO.md

@@ -37,6 +37,8 @@ All options will overwrite those previously set, except for the following option
 
 * The `extensions` option is an array of objects that can contain additional custom `renderer` and `tokenizer` steps that will execute before any of the default parsing logic occurs.
 
+Importantly, ensure that the extensions are only added to `marked` once (ie in the global scope of a regular JavaScript or TypeScript module). If they are added in a function that is called repeatedly, or in the JS for an HTML component in a library such as Svelte, your extensions will be added repeatedly, eventually causing a recursion error. If you cannot prevent the code from being run repeatedly, you should create a [Marked instance](/using_advanced#instance) so that your extensions are stored independently from the global instance Marked provides.
+
 ***
 
 <h2>The Marked Pipeline</h2>