Ability to create all content via API [and RemNote flavored markdown] (paste syntax)

Related:

Pasting Markdown

If you paste plain text into RemNote it gets interpreted as RemNote Flavored Markdown. The table below compares its syntax with common markdownmarkdown.

Format Markdown RemNote Flavored Markdown
bold **bold** or __bold__ only **bold**
italics _italics_ __italics__
You need space before the first and after the last __!
This is the same as Markdown bold!
underline - _underline_
This is the same as Markdown italics!
You need space before the first and after the last _!
Highlight - ^^highlight^^
Default: yellow (3)
Highlight with color - ^^highlight^^(N)
N = 1…6 where 5 and 6 are swapped for some reason
Headers # h1
###### h6
# h1
### h3
and some bugs, see below
Inline code `code` `code`
It is called quote and not styled monospace by default (Custom CSS for Quotes with " or monospace).
Code blocks ```block``` ```block```
Blocks are generated as separate rem.
Latex $$f = ma$$ $$f = ma$$ for display math
$f = ma$ for inline math.
Links [text](link) same
Image ![alt text](link) same
Image from clipboard (image/png) - yes
Audio - &[true](URL)
The true sets it as audio-only.
Video - &[anything but true](URL)
Cloze - {{text}}
By default all clozes in a rem are joined into one which gets a new random id.
There is a syntax to set the id manually, but I think this has to be an already existing id, so this is not useful.
Todo - [ ] todo
- [x] done
same
[[ref]] - [[ref]], [[top-level/child]]
Nesting is supported via /
As of 1.2.1 this searches top level rem only
undefined behavior if not unique
[[Daily Document]] - Use the format [[January 1st, 2021]] (code for JavaScript).
#tag - ##tag
#[[multi word tag]]
undefined if not unique
Portal - ((portal_id
use Copy Rem as Portal to find this id
Plugins - ^[plugin-name](url)
the url is ignored, only the name is relevant

Not implemented yet:

  • code blocks
  • todos
  • search portal
  • hierarchical selection of tags and references

API

Internally this rem
image
has this datastructure:


[Instead of name it is key in the IndexedDB lnotes.quanta store.]

The current API only allows setting name and content of a Rem as (Rich)text, i.e. only supports using the formatting described above. I think at least the API should support adding all formatting.

This can be implemented either by

  • improving the markdown formatting options (which seems quite limited) or
  • by allowing to supply a datastructure as name/content to the API, i.e. make API.update(rem._id, { name: rem.name }) a noop for plain rems.

Updates

  • New in v1.1: Codeblocks and todos
  • New in v1.2.1: Reference pasting rework
    • Only consideres top-level rem
    • Allow nesting/hierarchies with /, e.g. [[top-level-parent/child]]
  • New in v1.3: Single word tags start with ## to prevent accidental creation

Similarly I would like to be able to paste Rem from one account to another. This means to either

  • map all RemNote markup to markdown/html and parse it from there or
  • have an extra clipboard slot with a specific mime type just for RemNote with the relevant metadata.

Of cause both approaches can be used to add content to RemNote from another software.

1 Like

Is there a way to create aliases in the same way?

Note for clarification (for slow people like me) :
[[parent rem/child/grand child]] works
##parent rem/child/grand_child works (note the _ as it needs to be one word)

Thanks for sharing this handy overview!

I have not been able to link to a rem that doesn’t exist in RemNote before you actually paste/enter the markdown that would generates it in the first place (and where it is referenced at the same time).

This is not a surprise to me since it would require more elaborate processing of the pasted markdown, but I think it prevents the full creation of RemNote content from Markdown.

It is wonderful to make migrating data from other software to be a process of generating markdown files, but I have a question: what about Escape characters? For example, if I want to input ## (double hashes) in plain text, I need input like what I input in the normal markdown documents: \#\#, right?

I don’t think there are any escape sequences. But I agree that it would be a good idea to have them. Could you please record it as a feature request?

The best you can do ATM is wrap ## in `` quotes.

@hannesfrank Thanks for sharing this! But I get a problem recently. When I use the iOS Shortcuts app and create a new daily document via the api, it always creates two new pages with the same remid. It’s confusing me, and this is a link to shortcuts: Shortcuts
20211116142127

There is only one Daily Document created. The blue one is a plain rem containing a link to that page that just happens to be in the Daily Documents folder.

There is no clean way to create a daily document via api yet. If you don’t want to create it manually before using to ensure it exists the only way is via pasting a reference (like you did). Then you can either delete the rem containing the reference again (the telegram bot does this: https://github.com/pavlohrab/RemNote-bot/blob/master/bot.py#L89-L111) or keep it deliberately to nest content under it to show up in the daily documents backlink section, e.g. Thought Queue > [[November 15th, 2021]] > your content.

2 Likes

Thank for your explanations. Hope the New apiv1 can fix this issue.

In my experience:
Copying and pasting [[Authors/James]] will create a new rem called Authors with James as a child no matter what. I can have a top-level rem called Authors, remnote will ignore it and still create another top-level rem Authors … forcing me to do a merge everytime.
Reading the reply from Martin here, this is a bug : Documenting the "zombie rems" and sync related issues - #25 by Martin

This is one of the consequence of this bug:

2 Likes

Hi, @hannesfrank , I encountered a problem to create content by API

image
I want to create content like the picture above and then I send the content(Apple\r\tApple is delicious) in IFTTT. But the result is not what I want
image
Is there any way to solve the above problem? Thank you so much

Not easily. The API can only create one rem at a time. So you first need to create the Apple, get back the created rem id and then create the Apple is delicious with that id as parentId.

The exception is via references: You could create an [[Apple/Apple is delicious]] rem that only contains that reference, e.g. with parent From IFTT and then you can either ignore that page or delete the references there manually from time to time.

1 Like

image
The second way have a little shortcoming, The “;;” does not convert correctly to “→”

oh, one more thing, It seems that do not tag the “fruit”

I will try the first way later

1 Like

Hey there

Small Question
There is only Key Prefix how cam i get api key?