@descope/web-components-ui 1.0.304 → 1.0.305

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
 
3
3
  var merge = require('lodash.merge');
4
4
  var Color = require('color');
5
- var remarkable = require('remarkable');
5
+ var MarkdownIt = require('markdown-it');
6
6
 
7
7
  const DESCOPE_PREFIX = 'descope';
8
8
  const CSS_SELECTOR_SPECIFIER_MULTIPLY = 3;
@@ -4565,79 +4565,18 @@ var text$3 = /*#__PURE__*/Object.freeze({
4565
4565
  vars: vars$r
4566
4566
  });
4567
4567
 
4568
- const ruleSet = {
4569
- custom: ['image'],
4570
- core: [
4571
- 'block',
4572
- 'inline',
4573
- 'abbr', // Parse abbreviation definitions, i.e. `*[abbr]: description`
4574
- 'abbr2', // Enclose abbreviations in <abbr> tags
4575
- 'references',
4576
- 'footnote_tail',
4577
- 'replacements', // Simple typographical replacements
4578
- 'smartquotes', // Convert straight quotation marks to typographic ones
4579
- ],
4580
- inline: [
4581
- 'text',
4582
- 'newline', // Proceess '\n'
4583
- 'backticks', // Parse backticks
4584
- 'del', // Process ~~deleted text~~
4585
- 'emphasis', // Process *this* and _that_
4586
- 'sub', // Process ~subscript~
4587
- 'sup', // Process ^superscript^
4588
- 'links', // Process [links](<to> "stuff")
4589
- 'escape', // Proceess escaped chars and hardbreaks
4590
- 'ins', // Process ++inserted text++
4591
- 'mark', // Process ==highlighted text==
4592
- 'footnote_inline', // Process inline footnotes (^[...])
4593
- 'footnote_ref', // Process footnote references ([^...])
4594
- 'autolink', // Process autolinks '<protocol:...>'
4595
- 'htmltag', // Process html tags
4596
- 'entity', // Process html entity - &#123;, &#xAF;, &quot;, ...
4597
- ],
4598
- block: [
4599
- 'code', // Code block (4 spaces padded)
4600
- 'fences', // fences (``` lang, ~~~ lang)
4601
- 'blockquote', // Block quotes
4602
- 'list',
4603
- 'heading', // heading (#, ##, ...)
4604
- 'paragraph',
4605
- 'hr', // Horizontal rule
4606
- 'footnote', // Process footnote reference list
4607
- 'lheading', // lheading (---, ===)
4608
- 'htmlblock', // HTML block
4609
- 'table', // GFM table, non-standard
4610
- 'deflist', // Definition lists
4611
- ],
4612
- };
4613
-
4614
4568
  const textRuleSet = {
4615
- core: ['block', 'inline'],
4616
- inline: [
4617
- 'text',
4618
- 'newline', // Proceess '\n'
4619
- 'backticks', // Parse backticks
4620
- 'del', // Process ~~deleted text~~
4621
- 'emphasis', // Process *this* and _that_
4622
- 'sub', // Process ~subscript~
4623
- 'sup', // Process ^superscript^
4624
- 'links', // Process [links](<to> "stuff")
4625
- 'escape', // Proceess escaped chars and hardbreaks
4626
- 'ins', // Process ++inserted text++
4627
- 'footnote_inline', // Process inline footnotes (^[...])
4628
- 'footnote_ref', // Process footnote references ([^...])
4629
- 'autolink', // Process autolinks '<protocol:...>'
4630
- ],
4631
- block: [
4632
- 'code', // Code block (4 spaces padded)
4633
- 'fences', // fences (``` lang, ~~~ lang)
4634
- 'blockquote', // Block quotes
4635
- 'list',
4636
- 'heading', // heading (#, ##, ...)
4637
- 'paragraph',
4638
- 'footnote', // Process footnote reference list
4639
- 'htmlblock', // HTML block
4640
- ],
4569
+ components: {
4570
+ core: {
4571
+ rules: ['block', 'inline'],
4572
+ },
4573
+ block: {
4574
+ rules: ['blockquote', 'code', 'heading', 'list', 'paragraph', 'list'],
4575
+ },
4576
+ inline: {
4577
+ rules: ['backticks', 'strikethrough', 'link', 'emphasis', 'strikethrough', 'newline', 'text'],
4578
+ },
4579
+ },
4641
4580
  };
4642
4581
 
4643
4582
  const componentName$z = getComponentName('enriched-text');
@@ -4705,30 +4644,13 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
4705
4644
  }
4706
4645
  }
4707
4646
 
4708
- #disableAllRules() {
4709
- if (!this.processor) {
4710
- return;
4711
- }
4712
-
4713
- ruleSet?.core && this.processor.core.ruler.disable(ruleSet.core);
4714
- ruleSet?.inline && this.processor.inline.ruler.disable(ruleSet.inline);
4715
- ruleSet?.block && this.processor.block.ruler.disable(ruleSet.block);
4716
-
4717
- this.processor.renderer.rules.image = () => {
4718
- return '';
4719
- };
4720
- }
4721
-
4722
4647
  #enableCustomRules() {
4723
4648
  if (!this.processor) {
4724
4649
  return;
4725
4650
  }
4726
4651
 
4727
4652
  const customRuleSet = textRuleSet;
4728
-
4729
- customRuleSet?.core && this.processor?.core.ruler.enable(customRuleSet?.core);
4730
- customRuleSet?.inline && this.processor?.inline.ruler.enable(customRuleSet?.inline);
4731
- customRuleSet?.block && this.processor?.block.ruler.enable(customRuleSet?.block);
4653
+ this.processor.configure(customRuleSet || {});
4732
4654
 
4733
4655
  if (customRuleSet?.custom?.includes('image')) {
4734
4656
  this.processor.renderer.rules.image = this.#origImageRenderer;
@@ -4736,13 +4658,11 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
4736
4658
  }
4737
4659
 
4738
4660
  #updateProcessorRules() {
4739
- this.#disableAllRules();
4740
4661
  this.#enableCustomRules();
4741
4662
  }
4742
4663
 
4743
4664
  #initProcessor() {
4744
- this.processor = new remarkable.Remarkable();
4745
- this.#origImageRenderer = this.processor.renderer.rules.image;
4665
+ this.processor = new MarkdownIt();
4746
4666
  this.#updateProcessorRules();
4747
4667
  }
4748
4668
 
@@ -4758,7 +4678,7 @@ let EnrichedText$2 = class EnrichedText extends createBaseClass({ componentName:
4758
4678
  let html = this.textContent;
4759
4679
 
4760
4680
  try {
4761
- const tokens = this.processor.parse(this.textContent);
4681
+ const tokens = this.processor.parse(this.textContent, { references: undefined });
4762
4682
  html = this.processor.renderer.render(tokens, { breaks: true });
4763
4683
  } catch (e) {
4764
4684
  // eslint-disable-next-line no-console