Git Product home page Git Product logo

markasten's Introduction

markasten

A Zettelkasten tool for Markdown files.

Installation

markasten is a command line tool which can either be installed locally, or used via a Docker image.

To install locally using the Go toolchain:

go install github.com/andykuszyk/markasten/cmd/markasten@master
markasten --help

Or, to use via a Docker image:

docker run andykuszyk/markasten:latest markasten --help

Usage

Generate an index of tags from some files

The tags command is used to generate an index of files based on tags present in a header in each file. Headers are YAML formatted, and are expected to appear as frontmatter/metadata at the top of the file, enclosed in ---. Tags are expected in the tags key.

An example of a header is as follows:

---
tags:
- tag-one
- tag-two
---

The tags command can be invoked using the CLI:

markasten tags -i <path-to-input-files> -o <path-to-index-file> -t <index-title>

Or via the Docker image:

docker run -v "$(pwd)":/input -v "$(pwd)":/output andykuszyk/markasten:latest markasten tags --capitalize -i /input -o /output/README.md 

It supports the following flags:

$ markasten tags --help
Usage:
  markasten tags [flags]

Flags:
      --capitalize      If set, tag names in the generated index will have their first character capitalized.
      --debug           If set, debug logging will be enabled
  -h, --help            help for tags
  -i, --input string    The location of the input files
  -o, --output string   The location of the output files
      --tag-links       If set, links to files in the generated index will be annotated with the list of other tags they have.
  -t, --title string    The title of the generated index file (default "Index")
      --toc             If set, a table of contents will be generated containing a link to the heading of each tag
      --wiki-links      If set, links will be generated for a wiki with file extensions excluded

It can also be invoked using the GitHub Action in this repo:

name: docs
on: workflow_dispatch
jobs:
  tags:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: andykuszyk/markasten@master
        with:
          command: "tags"
          input: "docs/"
          output: "docs/README.md"
          additionalArgs: "--capitalize"
      - run: cat docs/README.md

For a working example of a tags workflow, see:

Find backlinks amongst files (TODO)

markasten backlinks find -i <path-to-input-files> -o <path-to-output-files>

Append backlinks idempotently to existing files (TODO)

markasten backlinks append -i <path-to-backlink-files> -o <path-to-target-files>

Development

  1. Clone this repo.
  2. Run go test ./...

Releases

Releases are created manually in GitHub, which will trigger a new Docker image to be built and published in GitHub Actions.

markasten's People

Contributors

andykuszyk avatar andykuszyk-form3 avatar emma-simmons-form3 avatar jeeves-form3 avatar

Watchers

 avatar  avatar

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.