Coder Social home page Coder Social logo

termwiki's Introduction

termwiki (work in progress)

What?

termwiki is a personal knowledge management tool for the terminal, with a focus on zero-thought, zero-wait when getting to the bit you're interested in.

It also:

  • Does pretty syntax highlighting and formatting with rich
  • Supports [[including]] bits and files within one another
  • Allows for high modularity for organizing your knowledge
  • Supports dynamic pages by executing Python code

Alternative phrasing: Information management for the terminal, focusing on zero-wait, zero-think when you're getting to the information you need.

This also has a ring to it: Access the information you need with zero wait time and no thinking.

Why?

Tools like Notion come with a big context switch. Navigating through the pages and waiting through loading times is awkward and slow.

When I don't remember how bash arrays work, I want to be able to type bash array and get whatever I wrote there, without having to leave the terminal.

I also want to edit my notes as easily as editing a local file with my editor of choice.

Usage

tw PATH [TO NESTED PAGE...]

termwiki parses the given page, then prints it.

By default, pages are looked for in ~/termwiki, or in TERMWIKI_PATH if set (multiple colon-separated paths are supported).

Basic example

Let's say you have a:

πŸ“‚ ~/termwiki/
β”œβ”€β”€ bash.md

Typing tw bash pretty-prints the contents of bash.md:

# Array
numbers=(1 2 3)

Everything is a Page

For high modularity, tw treats each of these as a page:

  • Plain files (.md or otherwise)
  • Whole directories
  • Python files
  • Variables, functions and classes within Python files
  • ...as well as within other variables / functions / classes

Nesting pages

Pages can be arbirarily nested in other pages, with no depth limit.

Together with the [[including]] syntax, and the ability to run Python code, this allows for a very flexible way to organize your knowledge.

Take this example:

πŸ“‚ ~/termwiki/
β”œβ”€β”€ πŸ“‚ bash/
β”‚   β”œβ”€β”€ array.md       # numbers=(1 2 3)
β”‚   β”œβ”€β”€ variable.md    # hello="world"

  • tw bash prints the contents of both array.md and variable.md, one after the other.
  • tw bash array prints numbers=(1 2 3).
  • tw bash variable prints hello="world".

Quick access, modularity, and [[include]]

You can control what tw renders when specifying a page, by nesting same-named pages under it. So with a directory, we would add a file inside that shares the directory's name.

termwiki will render only this nested page, instead of rendering all the others one by one.

In our case, we would add a bash.md file alongside array.md and variable.md:

πŸ“‚ ~/termwiki/
β”œβ”€β”€ πŸ“‚ bash/
β”‚   β”œβ”€β”€ array.md       # numbers=(1 2 3)
β”‚   β”œβ”€β”€ variable.md    # hello="world"
β”‚   β”œβ”€β”€ bash.md

Typing just tw bash now renders only bash/bash.md, not the other files.

If the content of bash.md was:

# Array
[[bash.array]]

# For
[[bash.for]]

tw bash would print the contents of both array.md and variable.md, plus a couple of titles.

This holds true for any type of page, including Python objects.

Replace bash/bash.md with a bash/bash.py:

array    = '[[bash.array]]'
variable = 'hello="world"'

def bash():
    guide = "www.etalabs.net/sh_tricks.html"
    
    return f"""# Bash
    {guide}
    {array}
    {variable}
    """

tw bash renders the return value of the bash() function, even though the bash() function is in a bash.py file which is in a bash/ directory.

Two things to note here:

  1. How [[bash.array]] can be used across different page types
  2. The guide variable inside the bash() function can be accessed via tw bash guide.

Click here for more information about page hierarchy.

Search, fuzzy paths, and interactive menus

If you give tw a path that doesn't exist, it tries hard to get what you wanted anyway, and if it's too ambiguous, it will prompt you to choose among its best guesses.

This is done in several ways:

  1. When it's not really ambiguous:
    • In our example above, tw array would render the array page, even though we omitted bash, since it's the only array page in the whole tree.
    • Even if an additional array page existed somewhere else, but the whole bash/ directory would be nested under a new languages/ directory, tw bash array would similarily render the correct array page, because there's only one bash > array page.
  2. File extensions are ignored, as well as letter casing, including non-alphanumeric characters (_, -, whitespace etc.) in page names.
  3. Fuzzy matching (Levenstein distance), so bash aray works.
  4. If all fails, a "Did you mean: [1] ..., [2] ..." prompt is shown.

UX Principles

Sorted by importance:

  • Instant retrieval of knowledge; must be about as quick as recalling a memory
  • Easy organization of potentially complex, nested information
  • Flexibility and modularity of information bits
  • No editing learning curve; Just edit local files like you've been doing for years

Extended Markdown

  • [[path.to.page]] to include other pages, reglardless of page type
  • Inline images and gifs
  • Embedding links
  • Proper syntax highlighting for ```lang blocks
  • Markdown # Headlines are pages
  • Comments that are # grey
  • rich formatting, or ascii color codes, are rendered even inside markdown. So this would actually [bright_blue]work[/].

Roadmap

  • Knowledge graph

Alternatives

termwiki might not be for you, in which case I would recommend either Notion, Dendron or Dnote.

Notion is the fanciest out there, and it's really good for heavy-duty, "this is my life's work" kind of usage. It's web-based, rather slow, and has an editing learning curve.

Dendron is local-first and lets you edit the files with your favorite editor, but it isn't a terminal tool (a VSCodium window), and doesn't support dynamic code execution; only static markdown files.

Dnote has a CLI, but doesn't support page nesting nor markdown, and has a paid Pro plan.

https://notesnook.com/

termwiki's People

Contributors

giladbarnea avatar giladbarneaallot avatar

Stargazers

 avatar

Watchers

 avatar

termwiki's Issues

Add a LICENSE

Hello! This project looks super cool and I'd love to try it out, but without any license, nobody can legally use your code :c

From GitHub's choosealicense.com:

For users

If you find software that doesn’t have a license, that generally means you have no permission from the creators of the software to use, modify, or share the software. Although a code host such as GitHub may allow you to view and fork the code, this does not imply that you are permitted to use, modify, or share the software for any purpose.

Your options:

  • Ask the maintainers nicely to add a license. Unless the software includes strong indications to the contrary, lack of a license is probably an oversight. If the software is hosted on a site like GitHub, open an issue requesting a license and include a link to this site. If you’re bold and it’s fairly obvious what license is most appropriate, open a pull request to add a license – see β€œsuggest this license” in the sidebar of the page for each license on this site (e.g., MIT).
  • Don’t use the software. Find or create an alternative that is under an open source license.
  • Negotiate a private license. Bring your lawyer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.