Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for org-mode code blocks #27

Open
choffee opened this issue Sep 5, 2023 · 2 comments
Open

Support for org-mode code blocks #27

choffee opened this issue Sep 5, 2023 · 2 comments

Comments

@choffee
Copy link

choffee commented Sep 5, 2023

Currently the code blocks are added with three backticks which works in logseq but is not valid for an org-mode file. Logseq supports both file formats. It would be good if this could support org mode as well.

#+BEGIN_SRC plantuml
... some code
#+END_SRC

I think you can get the "preferredFormat" from getUserConfig which should allow setting the template.

Looks like it might need the rendering code tweaking so it can find org-mode format as well.

@zmberber
Copy link

zmberber commented Sep 6, 2023

Can confirm. This is a bit annoying.

I would like to raise the following:

  • In markdown, every bullet point represents a markdown list item, which respects the hierarchy
  • In org mode, every bullet point represents an org-mode headline, of appropriate level, again reflecting the hierarchy. This means that the content is completely contained in the headline, and is not placed as a paragraph underneath the headline.
    • Ok, this is not completely true as soon as you have newlines, which normally doesn't happen in logseq i believe, but with source code blocks this happens.

At least for the moment, it seems like the way stuff is implemented, it would not work that easily if you just replaced it with #+begin_src and #+end_src, since those have to be at the beginning of a line and if you do that, the headline would be empty.

@zmberber
Copy link

zmberber commented Sep 6, 2023

ah wait, i am new to logseq, parts of what i said are not quite true. but the problems i mentioned are the cause of this problem, i believe.

logseq supports this:

  • type something in the bullet point as the "title" of the headline.
  • do a newline (via Shift+Enter)
  • optional: write more stuff and do a newline of the end of that stuff
  • type #+begin_src
  • type whatever you want for the source code block
  • type #+end_src

so everything should work like this.

for markdown this isn't a problem because these bullet points are converted in to list items, and list items don't have a title and content, everything is content, whereas in org-mode, you usually don't put long lines of content in an org headline title (but this is actually what logseq does and note taking apps like orgzly in some sense, too). You rather have separate content associated with that org headline. You cannot put code blocks or similar in org-headlines, whereas in markdown list items (in org mode too, for that matter), you can put in anything immeadiately, there is no "title" and "content" distinction.

It is interesting that logseq converts stuff to markdown as lists, and to org mode as org headlines, i wonder why it doesn't do the latter for markdown as well... i guess for markdown it makes less sense that way because headlines have less "functionality" as ones in org mode, whereas in org mode a lot is done via these org headlines.

Anyway, more importantly: Being able to write three backticks and having it be displated as code blocks should be disabled when the file is org-mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants