Markdown to MobileDoc converter

I learned specification: mobiledoc-kit. Is there any tool to convert markdown to this format?

I know that it can be converted following:


{
  "version": "0.3.1",
  "atoms": [],
  "cards": [
    [
      "markdown",
      {
       "markdown": "# ok\n\n```json\n{\n   ok: \"ok\"\n}\n```\n\n> xd\n \n<ul>\n    <li>aa</li>\n    <li>bb</li>\n</ul>\n\nTest"
      }
    ]
  ],
  "markups": [],
  "sections": [
    [
      10,
      0
    ],
    [
      1,
      "p",
      []
    ]
  ]
}

I mean by one big card, but I would like to process markdown to mobiledoc-kit format in a more sophisticated way. I mean change # ok to heading, change json\n{\n ok: \"ok\"\n}\n to card, and change list in HTML to mobiledoc-kit list. I would like to save also classes and attributes from HTML.

Why did I ask about it?

There is a well-known problem with using Grammarly and mobiledoc-editor. I have also other problems with this editor so I do not want to use it. But I want to use mobiledoc-kit format to save my posts created in ghost publishing platform. Creating one markdown card with teens thousand of characters make editor very hard to use.

I would like to use my own markdown editor and convert it to mobiledoc-kit format in an unequivocal way.

My propositions.

I was looking for that converter and did not found. So I see the following solutions.

  • modbiledoc-kit team will create a tool for this conversion
  • it would be possible with admin API v2
  • we can stay with the format that I presented initially but the efficiency of an editor with markdown card containing for example 50k characters should be improved
  • we make a possible selecting type of editor mobiledoc-kit or old markdown editor

What other problems are you having? Without feedback we can’t improve things ;-)

the efficiency of an editor with markdown card containing for example 50k characters should be improved

What problems are you experiencing with a large markdown card?


Straight markdown->mobiledoc is unlikely but we are working on html->mobiledoc and looking at ways to make that easier via tools/libraries and possibly with the v2 Admin API. Seeing as markdown->html is what markdown is designed for then there’s not much of a jump to markdown->html->mobiledoc, in fact if you paste markdown directly into the editor you’ll see that the conversion is already handled for you.

There are caveats however, mobiledoc is a little more restrictive in certain areas than markdown which allows mixing in free-form HTML. As such it’s possible that free-form HTML or scripts that are included in the markdown may be lost in the conversion.

1 Like

Problem that I have with decoupling post to mobiledoc-kit elements

Other problems with the editor.

Highlight syntax problem with mobiledoc-kit

As a writer in the view of post edition, I would like to type

```

then see code card like now, but with a possibility of language/syntax selecting.

For example in pure markdown, I can type

```json
{ test: “ok” }
```

and it is converted to

<pre><code class=“lang-json”>{ test: “ok” }</code></pre>

Then prism js can detect proper highlighting. But in mobiledoc-kit editor, there is not possible to select a language.

Workaround. Now I selecting mardown card and typing

```json
{ test: “ok” }
```

But It is inconvenient.

Proposed solutions

  • add a possibility of syntax selection to code card
  • make possible defining my own cards when I click “plus”. Now I see only primary and embed cards. I believe that if it would be more extensible/configurable community will create great fragments. This problem is also connected with embedding videos from Dropbox. To do this I need to create a fragment of HTML, but it could be done by one of these cards.
  • a possibility of a switch to standard markdown editor or fix big markdown cards efficiency problem with long texts.

References:

Markdown code block syntax highlighting · Issue #1091 · TryGhost/Ghost · GitHub

The second issue is very hard to solve the issue with Grammar plugin support.
Third problem portability. I am migrating from Jekyll + Github and represents the approach of a developer. I see that mobiledoc-kit can be converted to formats other than HTML and probably there is future in this direction. It seems to be great as storage of content. But it is a quite low-level format and I can’t send to text correction raw mobiledoc-kit document. Markdown syntax is well known and can be mixed with HTML in Jekyll and other static site generators. So it is not a problem of your editor but rather integration with external tools and processes where posts are stored in different format.

Problem with the approach - use one single markdown card and ignore rest of editor

What problems are you experiencing with a large markdown card?

Scenario:

  1. I created a markdown card. OK.
  2. I pasted there about 30k characters. OK.
  3. I clicked something else. Now the card is inactive. OK.
  4. I see something that I want to fix and click on this big card. PROBLEM
  • firstly browser changs out for some seconds
  • secondly, I was moved to the last line of my post

Below I attaching profile form chrome:

Dropbox - Profile-20190122T130059.json - Simplify your life

And screenshot


I am interested in testing a pre-release version of API Admin v2 and typing connector between Grammarly app and Ghost. It is a workaround for problems with an editor that I mentioned. Any estimated time to releasing this: 1 month, half year, 1 year?

Conversion from markdown to HTML is simple, so If you are going to implement PUT endpoint /post/id with field HTML and your backend will convert it to mobiledoc-kit, then my life is saved :) and I will stay with your platform.

And I have also two questions. First about versioning. There is table mobiledoc_revisions. But I can’t see any place in admin where can I see differences between revisions and switch between them. Is it version control management in admin planned?

Second about support for collaborative work. In GitHub, there is a great code revision tool that can be used also to work in text corrections. In Google docs, there are comments to the selected fragment of text and revision history with a great tool to compare revisions. In ghost, there is invisible for end-user version control and there is no possibility to add comments, questions, suggestions like in google docs.

I love the idea that Ghost is service that does one thing and does it great. So if I want to implement workflow saving suggestions like in GoogleDocs or comments to revisions like in GitHub I would like to rather integrate with these services than create a feature request to add comments to blog post inside of your service. When API v2 admin will be released It will be possible, especially because Google is preparing the release of his Google Docs API

How can developers edit a Google Doc programmatically? Is there a Docs API? - Stack Overflow

But I would like to get know your opinion about this topic. Are you planning support for collaborative work like commenting fragments like in Googe Docs or Medium? It seems to be possible with mobiledoc-kit format.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.