ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
SimpleDocumentMarkdown.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Data\Text\Shape;
22 
24 use ILIAS\Data\Text;
26 
28 {
32  public function getSupportedStructure(): array
33  {
34  return [
35  Structure::BOLD,
36  Structure::ITALIC,
37  Structure::HEADING_1,
38  Structure::HEADING_2,
39  Structure::HEADING_3,
40  Structure::HEADING_4,
41  Structure::HEADING_5,
42  Structure::HEADING_6,
43  Structure::UNORDERED_LIST,
44  Structure::ORDERED_LIST,
45  Structure::PARAGRAPH,
46  Structure::LINK,
47  Structure::BLOCKQUOTE,
49  ];
50  }
51 
52  public function fromString(string $text): Text\SimpleDocumentMarkdown
53  {
54  return new Text\SimpleDocumentMarkdown($this, $text);
55  }
56 
57  public function isRawStringCompliant(string $text): bool
58  {
59  $options = mb_regex_set_options();
60  try {
61  mb_regex_set_options("m");
62  return !mb_ereg_match(
63  '.*((' . MRE::IMAGE->value . ')|(' . MRE::REF->value . ')|(' . MRE::IMAGE_REF_USAGE->value . '))',
64  $text
65  );
66  } finally {
67  mb_regex_set_options($options);
68  }
69  }
70 }
MarkdownRegExps
Regular expressions to detect constructs from CommonMarkdown.