diff options
-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(_, _) -> |