Create a new instance of the MarkdownFileReader with the specified options for parsing markdown content from a file.
Optionaloptions: Partial<MarkdownFileReaderOptions>Optional configuration for the reader.
ProtectedruleProtectedfunctionProtectedtypeProtectedworkspaceThe workspace instance to which the parsed rules, functions, types, and constants will be added. This allows for components to recognize earlier declared components.
ProtectedblocksProtectedoptionsProtectedremoveProtectedreadProtectedreadProtectedisProtectedisProtectedisProtectedparseProtectedparseProtectedparseProtectedparseProtectedparseProtectedparseParse the content of a markdown file and return the result, including the successfully parsed markdown content and any errors encountered during parsing. A markdown file can read types, constants, rules, and functions.
The content of the markdown file to parse.
The result of parsing, including the successfully parsed markdown content and any errors encountered.
Protectedextract
Reader class for parsing markdown files that can contain constants, types, rules, and functions. You should use this class to read content from a markdown file, where code blocks have the expected syntax. The reader will parse the file content and return an object containing the successfully parsed elements as well as any errors encountered during parsing. This reader supports block-by-block reading, but each code block is treated independently. A component cannot be declared over 2 code blocks. All code must be in a code block with standard markdown syntax, e.g.
\n ... \n. The language identifier is optional and ignored. So any markdown file with foreign code will lead to the file failing. Only valid markdown files can be read. It also includes error handling for invalid syntax and duplicate keys, ensuring that the resulting objects are valid and usable within the rule engine.N.B. Declarations do not need to be in order, although that is still recommended.
N.B. This is a transactional safe reader. If you provide a workspace and select the option accept: 'all', then that workplace will not be affected if any errors are encountered.