Skip to content

Customizing

Noah Arcouette edited this page Jun 8, 2022 · 6 revisions

Colors

The /confs/default.json is the default configuration for IMD.

Sections

Each section has a name

Messages

  • error, error message
  • default, default text
  • highlight, highlighted section

Headers

  • h1, header 1 # h1
  • h2, header 2 ## h2
  • h3, header 4 ### h3

Lists

  • list, list and small underline - list or
line
----
  • tab-list, tab list > tablist

Links / Checks

  • brackets, the brackets on a link or check [alt](link) or - [check] list
  • alt, the alt of a link or check in a check box [alt](link) or - [check] list
  • link, link of a link [alt](link)

Underlines

  • underline, underline
underline
=========

Italisize

  • italic, italics *ital*
  • bold, bold **bold**
  • bold-italic, italic and bold ***ital-bold***

Syntax

  • syntax, default color for syntax
  • operator, operators ~!@$%^&*-+=|:;,#/\<>
  • string, string 'c' "string" and back ticks
  • number, numbers 0123456789.
  • bracket, brackets ()[]{}

Boxes / Decoration

  • box, box bar / outline
  • box-text, text inside of the box

Each Section Has Colors and Styles

  • fg, The foreground color
  • bg, the background color
  • styles, the text styles

Hex Colors

#RRGGBB

exp

#ff0000

Colors

  • default
  • black / gray
  • bright black / bright gray
  • red
  • bright red
  • green
  • bright green
  • yellow
  • bright yellow
  • blue
  • bright blue
  • purple
  • bright purple
  • cyan
  • bright cyan
  • white
  • bright white

Styles

  • bold
  • dim
  • italic / ital
  • underline / line
  • blink / blinking
  • reverse, reverse colors
  • strike, strike through the text
  • hidden / hide, no see

Configuring the Makefile

Flags

  • OUT, output binary
  • CC, base C compiler options -I./inc needed
  • VER, version if editing please add E- to the start so people know it's an edited version.

Commands

  • all, test
  • test, random tests
  • configure, commands ran before any building
  • clean, clean up unneeded files
  • build, build for development
  • install, install IMD
  • uninstall, uninstall IMD
  • ${OUT}, base build of IMD

conf.py

conf.py generates the conf.h file from /confs/default.json, sorry that conf.py is spaghetti code.

genversion

genversion get git rev-list and generates vinfo.h

Files

/src/main.c

Controls all other function calls.

/src/useful.c

Contains useful functions.

/src/settings.c

Reads argc and argv, returns settings structure with the parse data.

Also shows version info is -v or --version

/src/reader.c

Reads file or pipe.

/src/styling.c

Styles the raw data using bit fields, counters, and colors.

/src/syntax.c

Only ran if -s and --no-syntax are not set.

An extension of /src/styling.c used for styling syntax.

/src/split.c

Splits data input into a list of strings to be less or raw printed, and decorated.

/src/rawPrint.c

Only ran if -r or --raw is set.

Prints data with decoration if not -d and --no-decoration.

/src/lessPrint.c

Only ran if -r and --raw are not set.

Print data with decoration if not -d and --no-decoration.

Prints with a pager and some simple vim inspired commands.

Use char keypress () to get one keypress.

/src/menu.c

void addDir (char *path, struct StrArray *files); Gets all .md or .MD files in all directories and sub-directories of path then adds them to files.

ssize_t showMenu (struct StrArray files, struct Settings s); Show and selects all files. Return value is the index of the file in files or -1 if non selected.

void menu (struct Settings *s); Controls and sets up the menu. Value s->file will be changed to selected file.

/inc/chars.h

Defines some useful chars.

/inc/reader.h

Defines stuff for /src/reader.c

/inc/settings.h

Defines bit field data and Settings structure.

/inc/split.h

Defines StrArray structure.

/inc/styling.h

Defines bit field data.

/inc/menu.h

Defines menu function.

Sources

Edit the ./inc/ or ./src/ directories in the git repo.

Or once installed edit the /etc/imd/src/ directory then build with imd-rebuild <cflags>. Warning: the genversion and conf.py files have already been ran at install and not copied to /etc/imd/. Edit /etc/imd/src/vinfo.h file for version info, and /etc/imd/src/conf.h for colors.