Skip to content

sawhney17/logseq-schrodinger

Repository files navigation

Contributors Forks Stargazers Issues MIT License


Logo

logseq Schrödinger

An awesome Logseq plugin to jumpstart your digital garden 🌱!
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Installation
  3. Configuration
  4. Issues
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

Product Name Screen Shot

Logseq is a great PKM (personal knowledge management) tool, but keeping your knowledge for yourself only gets you so far. As Erwin Schrödinger stated:

If a note is not published, does it really exist? — Erwin Schrödinger

Knowledge is meant to be treasured and expanded, but before all shared. This plugin helps to make that possible, or at least easier.

Note: This project is very much a work-in-progress. Please report issues and questions.

(back to top)

Installation

Preparation

  • Click the 3 dots in the righthand corner and go to Settings.
  • Go to Advanced and enable Plug-in system.
  • Restart the application.
  • Click 3 dots and go to Plugins (or Esc t p).

Install plugin from the Marketplace (recommended)

  • Click the Marketplace button and then click Plugins.
  • Find the plugin and click Install.

Install plugin manually

  • Download a released version assets from Github.
  • Unzip it.
  • Click Load unpacked plugin, and select destination directory to the unzipped folder.

(back to top)

Configuration

  • Click the 3 dots in the righthand corner and go to Settings.
  • Go to Plugin Settings.
  • Select correct plugin.

Configuration screen

(back to top)

Meta-data

This plugin uses YAML for the Hugo front-matter. It will convert Logseq page-properties to Hugo front matter.

Logseq keywords are lowercase converted to Hugo keywords, and category in Logseq is translated to categories for use with Hugo. Logseq links ([[like_this]]) are stripped of [[ and ]].

All other keywords are just converted to Hugo keywords.

For now you must add date with the posts date in the form of "2012-04-06" to your Logseq page-properties.

date:: 2012-04-06

Configuring Hugo

Hugo does not by default support backlinks. Use a snippet like the following to simulate backlinks. It will parse every page for local links. This snippet should be placed in ~yourhugo/layouts/partials/backlinks.html.

{{ $re := $.File.BaseFileName }} {{ $backlinks := slice }} {{ range where
.Site.RegularPages "Type" "page" }} {{ if and (findRE $re .RawContent) (not (eq
$re .File.BaseFileName)) }} {{ $backlinks = $backlinks | append . }} {{ end }}
{{ end }} {{ if gt (len $backlinks) 0 }}
<aside>
  <h3>Backlinks</h3>
  <div class="backlinks">
    <ul>
      {{ range $backlinks }}
      <li class="capitalize"><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
      {{ end }}
    </ul>
  </div>
</aside>
{{ else }}
<aside>
  <h4>No notes link to this note</h4>
</aside>
{{ end }}

<aside class="related">
  {{ $related := .Site.RegularPages.Related . | complement $backlinks | first 3
  -}} {{ with $related -}}
  <h3>slightly related</h3>
  <ul>
    {{ range . -}}
    <li class="capitalize"><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
    {{ end -}}
  </ul>
  {{ end -}}
</aside>

Admonitions

Logseq has several built-in adminitions, namely:

  • caution
  • example
  • important
  • note
  • pinned
  • tip
  • quote
  • warning

These get converted to:

{{< logseq/orgCAUTION >}}Caution here{{< / logseq/orgCAUTION >}}
{{< logseq/orgEXAMPLE >}}This is an example{{< / logseq/orgEXAMPLE >}}
{{< logseq/orgIMPORTANT >}}This is important{{< / logseq/orgIMPORTANT >}}
{{< logseq/orgNOTE >}}This is a note{{< / logseq/orgNOTE >}}
{{< logseq/orgPINNED >}}This is pinned{{< / logseq/orgPINNED >}}
{{< logseq/orgTIP >}}This is a tip{{< / logseq/orgTIP >}}
{{< logseq/orgQUOTE >}}This is a quote{{< / logseq/orgQUOTE >}}
{{< logseq/orgWARNING >}}This is a warning{{< / logseq/orgWARNING >}}

So Hugo needs those in ~yourhugo/layouts/shortcodes/logseq/:

orgCAUTION.html
orgEXAMPLE.html
orgIMPORTANT.html
orgNOTE.html
orgPINNED.html
orgQUOTE.html
orgTIP.html
orgWARNING.html

And they should contain something along the lines of:

<div class="caution {{ .Get 0 }}">{{ .Inner | $.Page.RenderString }}</div>

(back to top)

Website templates

There are some basic website templates you can take it as a reference.

  1. logseq-hugo-template, by sawhney17.
    1. You can host your personal website with your favorite web hosting providers.
  2. Logseq-Hugo-Template, by CharlesChiuGit.
    1. Host your personal website with free GitHub pages.

(back to top)

Issues

See the open issues for a full list of proposed features (and known issues).

What works

  • Local Hugo links (but Logseq uses one folder for everything, so Hugo does too)
  • Block refs(!) — On conversion the block is pulled from the other location
  • Images
  • Basic Markdown styling (including highlighting!)

What is known to not work

  • Indentation Logseq ➡ Hugo is still a work-in-progress

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Aryan Sawhney - @Aryan Sawhney

Project Link: https://github.com/sawhney17/logseq-schrodinger

(back to top)

Acknowledgments

I would like to thank Alex Qwxlea (@twitter_handle) for the idea to write this Logseq plugin. Also for breaking the plugin after I wrote it. And finally, thank him for adding this note: Qwxlea, you're the best 😁!