MarkMindCkm / obsidian-enhancing-mindmap

obsidian plugin editable mindmap,you can edit mindmap on markdown file
MIT License
575 stars 51 forks source link

[Feature Plan] Export to OPML #62

Open djscheuf opened 2 years ago

djscheuf commented 2 years ago

I noticed that there is a planned feature for Exporting to OPML format from the existing Markdown. I thought it would be helpful to collect some resources for such an improvement and potentially outline some TestCases for the same.

Based on the Wikipedia article on OPML, I was able to find the Specs for OPML 2.0. And using the examples and description there I would outline the following expectations, based on my usage of this plugin.

  1. The Title for an Obsidian Mindmap is the # level heading, and is the central Node in a MindMap. A mindmap with just a central node should therefore the following markdown
    
    ---

mindmap-plugin: basic


Central Node


produces OPML like this:
```opml
<?xml version="1.0" encoding="ISO-8859-1"?>
<opml version="2.0">
    <head>
        <title>Central Node</title>
    </head>
    <body>
        <outline text="Central Node" />
    </body>
</opml>
  1. All Child Nodes after the first level live based on indentation level of a Bullet List of their Parent. In OPML all children generate a new Outline Node underneath their parent. So some special parsing around finding the ## level children and the children marked by - will be needed. Given Markdown like:
    # Some Idea
    ## Freedoms
    - Discoverable
    - Transferable
    - Teaching
    - Composable
    ## Constraints 
    - Not Everything is easy

You should get OPML like:

<?xml version="1.0" encoding="ISO-8859-1"?>
<opml version="2.0">
    <head>
        <title>Some Idea</title>
    </head>
    <body>
        <outline text="Some Idea" >
            <outline text="Freedoms" >
                <outline text="Discoverable" />
                <outline text="Transferable" >
                    <outline text="Teaching" />
                </outline>
                <outline text="Composable" />
            </outline>
            <outline text="Constrains" >
                <outline text="Not everything is easy" />
            </outline>
        </outline>
    </body>
</opml>

These examples were manually constructed based on Samples for the optional Category Attribute and a sample for an outline of US States and cities