Markdown, Notes, and Drive

Is there any way for .md (Markdown) files created locally in a Drive folder to be recognized as Notes, and thereby parsed on the Summary page? The workaround is to first create an empty Note, set the type to Markdown, let the .md sync down to the folder, then edit it locally. Not a very good solution…

0 votes

1 answers

1142 views

ANSWER



When you are using Drive, the Nuxeo platform actually makes use of the FileManager for import. The FileManager checks the mimetype, and creates the corresponding document type.

You can have a look at this contribution to see the default types depending on a given mimetype: http://explorer.nuxeo.org/nuxeo/site/distribution/current/viewContribution/org.nuxeo.ecm.platform.filemanager.service.FileManagerService.Plugins--plugins

From this contribution, you can see that anything received with the “text/x-web-markdown” mimetype will be treated as a note by default.

There is therefore a chance that your application is not generating the correct mimetype for the FileManager to understand it. In such case, you could specify this mimetype and say that it should generate a Note by adding a XML contribution looking like this:

<extension point="plugins" target="org.nuxeo.ecm.platform.filemanager.service.FileManagerService">
<plugin class="org.nuxeo.ecm.platform.filemanager.service.extension.NoteImporter" name="MyMarkdownImporter" order="9">
  <filter>add/your/own/mimetype/here</filter>
</plugin>
</extension>

This extension can easily be added through Nuxeo Studio or a development plugin project.

1 votes



Thank you Bertrand. Working off of your answer I have manually created the following registry key in Windows 7:

key - HKCR.md\Content Type value - text/x-web-markdown

And now everything works fine - .md files are imported as notes and parsed properly on the Summary page.

05/27/2014

Great news :) Thanks for the feedback!
05/27/2014