diff options
author | Sébastien Dailly <sebastien@dailly.me> | 2021-11-25 08:59:29 +0100 |
---|---|---|
committer | Sébastien Dailly <sebastien@dailly.me> | 2022-02-07 16:43:33 +0100 |
commit | f30e3eeb06bb932e6735868d404926cc7a9cd8aa (patch) | |
tree | 0bf47bf5c81c61c279bc82b969f70a080c3ae45f | |
parent | 536ca039cbae6025ae210231cdc149430be09b4e (diff) |
List all the cases in the Markdown pattern
-rwxr-xr-x | editor/actions/of_markdown.ml | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/editor/actions/of_markdown.ml b/editor/actions/of_markdown.ml index 88f7c00..951feed 100755 --- a/editor/actions/of_markdown.ml +++ b/editor/actions/of_markdown.ml @@ -154,7 +154,7 @@ module FromMarkdown = struct (* The whole list node is declared as ordered or bullet depending of the type given by the markdown. - Each element insiide the list is transformed as a list_item. + Each element inside the list is transformed as a list_item. The list_item node can itself contains other blocks (recursively) *) let nodes = List.map elements @@ -206,9 +206,26 @@ module FromMarkdown = struct (Js.null) in Some node - | Code_block(_, _, _) - (* TODO *) - -> None + | Code_block(attrs, content, format) -> + ignore attrs; + + (* The language format is ignored (I do not provide syntaxic + coloration) *) + ignore format; + + (* TODO Check if this work *) + let nodes = Js.array + [| view##.state##.schema##text + (Jstr.of_string content) + (Js.null) + |] in + let fragment = PM.Model.Fragment.from_array pm nodes in + let node = view##.state##.schema##node + (Jstr.v "code_block") + (Js.null) + (Js.some fragment) + (Js.null) in + Some node | Html_block(_, _) | Definition_list(_, _) -> |