Skip to content

co-dh/qnote

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Simple Notebook for Q Programming Language

Given a Q file with a \ (on a single line without space) started comment block at the end of file, with next line started with # and a space for Markdown level head, and Markdown inside the comment, it will generated a Markdown file from it:

  • The file is a legitimate Q file
  • Put q code at the beginning
  • Markdown start with a line with single slash \, and # space on the next line.
  • Switch to k mode is not supported. Use 0N! to display like k when needed.
  • q code inside ~~~q block will be executed, and results will be put inside markdown's code block
  • q coed inside ```q blcok will be executed, and results will be put into markdown directly, so you can generate markdown from Q.

Basic Example:

    show f 1

Will generate

    show f 1
2

Example usage of header, body and separator functions

    show t: ([] a: 1 2; b: `c`d)
a b
---
1 c
2 d
    show header t
"|a|b|"
    -1@body t;

|1|c|
|2|d|
    show separator t
"\n|-|-|"

Example: Generate markdown table from q

The following code can be used to generate a markdown table

   -1@header[t] ,separator[t], body t;

Will generate

-1@header[t] ,separator[t], body t;

Usage

This README.md is generated by qnote.q like below.

    
$ ./qnote2.q README.q > README.md

Library Code1

f:{x+1}
wrap:{"|",x,"|"};
header:{wrap "|" sv string cols x}
body:{"\n", "\n" sv wrap each "|" sv/:string flip value flip x}
separator:{"\n", wrap "|" sv enlist each count[cols t] # "-"}

Footnotes

  1. This file is generated by qnote2.q

About

Poor man's notebook for Q programming language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published