# \[DONE\] Easy import of markdown docs to wiki

**URL:** <https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307>\
**Category:** Ideas & Features\
**Tags:** import\
**Created:** [August 24, 2019, 2:04pm UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307 "2019-08-24T14:04:39Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![rickcogley](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/rickcogley/32/274_2.png) [@rickcogley](https://community.fibery.io/u/rickcogley)\
**Post date:** [August 24, 2019, 2:04pm UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/1 "2019-08-24T14:04:39Z")

</div>

Hello - I have a considerable number of docs in markdown. The wiki docs / other docs, is not really compatible with simply copy-pasting markdown you have.

Anything that can be done?

---

<div class="post-metadata">

**Author:** ![Vladimir\_Petriko](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/vladimir_petriko/32/236_2.png) [@Vladimir\_Petriko](https://community.fibery.io/u/Vladimir_Petriko)\
**Post date:** [August 26, 2019, 11:40am UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/2 "2019-08-26T11:40:23Z")

</div>

Wiki doesn’t support copy-pasting markdown at the moment.  
The workaround I can offer now is to use direct fibery api to update whole document with markdown content: [https://api.fibery.io/#update-rich-text-field](https://api.fibery.io/#update-rich-text-field)

---

<div class="post-metadata">

**Author:** ![rickcogley](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/rickcogley/32/274_2.png) [@rickcogley](https://community.fibery.io/u/rickcogley)\
**Post date:** [August 26, 2019, 9:48pm UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/3 "2019-08-26T21:48:32Z")

</div>

ah, right, that will work. Actually my docs are in a database and happen to be in markdown format in a text field. I can get a json dump of them, then use `jq` to cook up a script to push them in via curl. Problem is slogging through to figure out what is useful or not. 🙂

---

<div class="post-metadata">

**Author:** ![Pagandai\_V\_Pannirsel](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/pagandai_v_pannirsel/32/177_2.png) [@Pagandai\_V\_Pannirsel](https://community.fibery.io/u/Pagandai_V_Pannirsel)\
**Post date:** [October 26, 2019, 7:19pm UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/4 "2019-10-26T19:19:13Z")

</div>

This is indeed , the notion app well made as well embed , but maker user experience for non code user who did not know makdown format

---

<div class="post-metadata">

**Author:** ![uniquelau](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/uniquelau/32/3836_2.png) [@uniquelau](https://community.fibery.io/u/uniquelau)\
**Post date:** [January 11, 2022, 6:51pm UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/5 "2022-01-11T18:51:42Z")

</div>

As a general comment being able to paste markdown would be rather nice, especially for us people who write notes in markdown in text editors and then want to paste them quickly in.

(e.g. customer raises an issue on the phone, and I capture some notes in using a text editor)

---

<div class="post-metadata">

**Author:** ![Oshyan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oshyan/32/11431_2.png) [@Oshyan](https://community.fibery.io/u/Oshyan)\
**Post date:** [February 11, 2022, 6:51pm UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/6 "2022-02-11T18:51:28Z")

</div>

With the [recent idea of using Fibery for public docs and other things](https://community.fibery.io/t/public-view-sharing/1885), it seems like being able to get any _existing_ docs into Fibery will be important. Most people will not want to use API for this. **At a minimum** markdown pasting should be supported. And ideally bulk Markdown import to map to individual Docs (or even entities+rich text?) would be great. Few companies are going to have no existing docs, and so they will want to move such docs into Fibery in the most efficient way.

---

<div class="post-metadata">

**Author:** ![Oshyan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oshyan/32/11431_2.png) [@Oshyan](https://community.fibery.io/u/Oshyan)\
**Post date:** [July 18, 2022, 9:51pm UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/7 "2022-07-18T21:51:03Z")

</div>

I’m getting close to doing a big migration of multiple processes and 100s of associated docs into Fibery, or rather I’m _wanting_ to do this, but have no ability to utilize the API myself (not a coder). This kind of import option, or at _least_ a basic markdown paste interpretation, seems increasingly vital as Fibery positions itself more and more as a documentation, etc. solution. I know there is a lot going on, but can some useful aspect of this work be prioritized?

Or is there at least a workaround, like can I put all my docs into a CSV and import to Entity _Rich Text_ that way? I know I could test it, but would appreciate an official answer rather than having to do some data wrangling to test it. 😄

---

<div class="post-metadata">

**Author:** ![Oshyan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oshyan/32/11431_2.png) [@Oshyan](https://community.fibery.io/u/Oshyan)\
**Post date:** [July 20, 2022, 12:03am UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/8 "2022-07-20T00:03:04Z")

</div>

OK, well… there’s a workaround that might be manageable for a short while, _if_ you use a Database for your “docs” (which IMO is often a good idea anyway):

- Create a Button that Overwrites (or appends/prepends, if you prefer) your Entity Description
- Enable “Ask for user input” for the contents
- Copy markdown from source, invoke button, paste, complete

Hey, magic, you have markdown “import”! It’s slow, it’s clunky, but… it works better than trying to just paste directly into the description (which does not work at all). 😄

And if you really need it in a Doc, you can now successfully copy/paste with formatting from the Entity Description to a Doc. Highly ironic that _this_ works, but markdown copy/paste does not, especially given that Fibery more or less supports markdown. 🙄

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [July 20, 2022, 7:21am UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/9 "2022-07-20T07:21:57Z")

</div>

> [@Oshyan](#):
>
> can I put all my docs into a CSV and import to Entity _Rich Text_ that way?

~~If the contents of the docs are not too big, you can actually do the following:~~  
~~- create a simple text field (called ‘Scratchpad’ or something)~~  
~~- define an automation that copies contents of this simple text field to the rich text field you want to use, whenever the simple text field is updated~~  
~~- import the text/markdown into the simple text field, using CSV import~~

Ignore this!

---

<div class="post-metadata">

**Author:** ![Oshyan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oshyan/32/11431_2.png) [@Oshyan](https://community.fibery.io/u/Oshyan)\
**Post date:** [July 21, 2022, 5:15pm UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/10 "2022-07-21T17:15:07Z")

</div>

Hmm, OK that’s good to know. But can’t I just import to a Rich Text/Description field anyway? From a quick test import (without actually committing the data) it appears that Rich Text is available for mapping from source data. Am I missing something?

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [July 21, 2022, 5:59pm UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/11 "2022-07-21T17:59:02Z")

</div>

You’re absolutely right - it is possible to directly import into rich text. My fault for not checking that first - I had used the method suggested a while back for a different reason; I can’t recall if import to rich text was available at that time.  
So yeah, if your source text is formatted as markdown correctly, then you should have no problems. Sorry for the confusion.

---

<div class="post-metadata">

**Author:** ![Oshyan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oshyan/32/11431_2.png) [@Oshyan](https://community.fibery.io/u/Oshyan)\
**Post date:** [July 21, 2022, 8:44pm UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/12 "2022-07-21T20:44:18Z")

</div>

Ah good, no worries! It’s a reasonable approach. I still strongly wish for _at least_ single import (or copy/paste handling) for markdown into docs, and ideally _bulk_ import of .md files to docs. It’s such a simple format and Fibery already mostly supports it. It could be a big help for people trying to migrate into Fibery from other tools = sales driver!

---

<div class="post-metadata">

**Author:** ![Michel\_Daviot](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/michel_daviot/32/6094_2.png) [@Michel\_Daviot](https://community.fibery.io/u/Michel_Daviot)\
**Post date:** [January 27, 2023, 5:31pm UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/13 "2023-01-27T17:31:13Z")

</div>

I second this need. Migrating my team from Notion, we have a few hundred pages (FAQ, internal documentation, specifications …) which would be a pain to move to Fibery.

Only workaround I have for now is

- export from notion as markdown + image (one zip file for a space or folder)
- open folder in an IDE such as IntelliJ
- open each page as markdown viewer
- select all, copy
- open proper page in fibery, paste (which thanksfully keeps most formatting and inserts images)

I’d really appreciate a way to automate this process.

---

<div class="post-metadata">

**Author:** ![Michel\_Daviot](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/michel_daviot/32/6094_2.png) [@Michel\_Daviot](https://community.fibery.io/u/Michel_Daviot)\
**Post date:** [February 1, 2023, 11:09am UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/14 "2023-02-01T11:09:59Z")

</div>

I’ve started work on a script which would automate this migration from a notion export (basically any folder with markdown and picture files, similar to what you would share on github/gitlab …).

What works

- updating a rich text field from a markdown file

```shell
curl -X POST https://colisweb.fibery.io/api/commands \
     -H 'Authorization: Token SECRET' \
     -H 'Content-Type: application/json' \
     -d \
      '[
         {
           "command": "fibery.entity/query",
           "args": {
             "query": {
               "q/from": "Produit/Solution",
               "q/select": [
                 "fibery/id",
                 "Produit/Name",
                 { "Produit/Description": ["Collaboration~Documents/secret"] }
               ],
               "q/where": ["=", ["Produit/Name"], "$name" ],
               "q/limit": 2
             },
              "params": {
              "$name": "Test End 2 End Suivi de colis"
            }
           }           
         }
      ]'

```

```shell

jq '.content = $md' --arg md "$(< /tmp/md)" --null-input > /tmp/json

# use fibery/id from previous command

curl -X PUT https://colisweb.fibery.io/api/documents/$fiberyId?format=md \
     -H 'Authorization: Token SECRET' \
     -H 'Content-Type: application/json' \
     -d "$(</tmp/json)"

```

- uploading an image to fibery

```shell
curl -X POST https://colisweb.fibery.io/api/files \
     -H 'Authorization: Token SECRET' \
     -H 'content-type: multipart/form-data' \
     -F 'file=@/tmp/Untitled.png'

```

# Where I need help

How can I use the uploaded png file in the markdown rich-text field ?  
IE, how to I replace `![Untitled](/Untitled.png)` in my original markdown file ?

---

<div class="post-metadata">

**Author:** ![Michel\_Daviot](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/michel_daviot/32/6094_2.png) [@Michel\_Daviot](https://community.fibery.io/u/Michel_Daviot)\
**Post date:** [February 1, 2023, 1:13pm UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/15 "2023-02-01T13:13:13Z")

</div>

> [@Michel\_Daviot](#):
>
> IE, how to I replace `![Untitled](/Untitled.png)` in my original markdown file ?

I found the answer by peeking at the network view when doing it by hand, it is simply  
`![Untitled](/api/files/ba511eea-f8bb-447e-9fda-b8c5fddfaa22)`

(with “fibery/secret”: “ba511eea-f8bb-447e-9fda-b8c5fddfaa22” in the answer to the upload request)

---

<div class="post-metadata">

**Author:** ![Michel\_Daviot](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/michel_daviot/32/6094_2.png) [@Michel\_Daviot](https://community.fibery.io/u/Michel_Daviot)\
**Post date:** [February 3, 2023, 3:35pm UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/16 "2023-02-03T15:35:27Z")

</div>

I’ve made great progress on one area : I can now with [this script](https://gitlab.com/tyrcho/code-samples/-/blob/master/scala/short/ImportMarkdownFibery.sc) (it’s scala but you should be able to port it easily to python or javascript) **update all the entities with markdown + images** , in a chosen field.

I’m now struggling with **creating documents and folders from the API**. I have not found documentation [here](https://api.fibery.io) and based on [these](https://community.fibery.io/t/creating-a-new-document-via-the-api/2889) [posts](https://community.fibery.io/t/are-documents-being-deprecated/2947/4) I’m worried if this is possible.

Maybe @Oleg or @Chr1sG you could clarifiy the status about the API for managing documents and folders ?

---

<div class="post-metadata">

**Author:** ![Oleg](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oleg/32/1887_2.png) [@Oleg](https://community.fibery.io/u/Oleg)\
**Post date:** [February 3, 2023, 4:20pm UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/17 "2023-02-03T16:20:09Z")

</div>

Hi, @Michel_Daviot

Please find my js function to create/update docs

```auto
    const getDocumentsBatchCommand = (command) => async ({client, format, args}) => {
        logger.info(`[Fibery API]: Collab doc command: ${command} with ${args.length} ${format} docs`);
        return client.post(`api/documents/commands`, {
            searchParams: {
                ratelimit: 'on',
                format,
            },
            json: {
                command,
                args,
            },
            headers: await getAuth(),
        });
    };
    const updateDocuments = getDocumentsBatchCommand('create-or-update-documents');
    const appendDocuments = getDocumentsBatchCommand('create-or-append-documents');

```

where `format` is one of `md`, `json`, `html` or `text`

and args is array of elements which looks like

```auto
{
            secret: `XX-YY-ZZZ-it is just a doc secret`,
            content:`Hello`
 }

```

---

<div class="post-metadata">

**Author:** ![Oleg](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oleg/32/1887_2.png) [@Oleg](https://community.fibery.io/u/Oleg)\
**Post date:** [February 3, 2023, 4:25pm UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/18 "2023-02-03T16:25:15Z")

</div>

Please find below an example of creating folder

```auto
    const createFolder = async ({client, app, name, parent = null, publicId = null}) => {
        const operationId = uuid.v4();
        const folderId = uuid.v4();
        const result = await client.post(`api/views/json-rpc`, {
            json: {
                jsonrpc: `2.0`,
                method: `create-folders`,
                params: {
                    values: [
                        {
                            'fibery/Parent Folder': parent,
                            'fibery/id': folderId,
                            'fibery/name': name,
                            'fibery/container-app': {'fibery/id': app.id},
                            'fibery/public-id': publicId,
                        },
                    ],
                },
                id: operationId,
            },
            headers: await getAuth(),
        });
        if (result.error) {
            throw new Error(result.error.message);
        }
        return _.get(result, `result[0]`);
    };

```

In my code call looks like

```auto
const folder = await fibery.createFolder({
    app: app,
    name: folderName,
    parent: {'fibery/id': getFiberyId(step)},
});

```

---

<div class="post-metadata">

**Author:** ![Michel\_Daviot](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/michel_daviot/32/6094_2.png) [@Michel\_Daviot](https://community.fibery.io/u/Michel_Daviot)\
**Post date:** [February 3, 2023, 4:43pm UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/19 "2023-02-03T16:43:34Z")

</div>

I’ve added some documentation to the script. Also here is how I export from notion :  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/4/460a896fc63e00ce303236597e55c32281d15290.png)

Thanks @Oleg I’ll try those to upload the rest of my data !

---

<div class="post-metadata">

**Author:** ![Oleg](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oleg/32/1887_2.png) [@Oleg](https://community.fibery.io/u/Oleg)\
**Post date:** [February 3, 2023, 4:50pm UTC](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307/20 "2023-02-03T16:50:31Z")

</div>

@Michel_Daviot

Nice, I believe we will add support for integration apps in future to allow the import of documents and folders. It is partly implemented, but I am waiting for fibery core implementation of sub-documents.

[Next page](https://community.fibery.io/t/done-easy-import-of-markdown-docs-to-wiki/307.md?page=2)
