Skip to content

Releases: xNaCly/fleck

0.0.4-alpha+conf.1

19 May 06:21
Compare
Choose a tag to compare
fleck --version
# fleck: [ver='bare:0.0.4-alpha+conf.1'][buildAt='2023-05-19T08:22:37.689817'][buildBy='[email protected]']

Features

Better arguments debugging

Previously, arguments were printed via string concatenation when calling cli.Arguments.String() (is called when fleck is invoked with --debug), this was changed to stringifying the arguments struct via json.Marshal:

fleck --debug tester.md
# 2023/05/19 08:02:05 debug: [arguments:
# {
#        Files: [
#                'tester.md', ],
#        Flags: [
#        ], Args: [
#                --port: '12345',
#        ]
# }]
# 2023/05/19 08:02:05 error: failed to stat the file

Now:

fleck --debug tester.md
# {
#       "Flags": {
#               "config": false,
#               "debug": true,
#               "escape-html": false,
#               "help": false,
#               "keep-temp": false,
#               "live-preview": false,
#               "math": false,
#               "no-prefix": false,
#               "no-template": false,
#               "preprocessor-enabled": false,
#               "shell-macro-enabled": false,
#               "silent": false,
#               "syntax": false,
#               "toc": false,
#               "toc-full": false,
#               "version": false,
#               "watch": false
#       },
#       "Args": {
#               "port": "12345"
#       },
#       "Files": [
#               "tester.md"
#       ]
# }
# 2023/05/19 08:03:19 error: stat tester.md: no such file or directory

Markdown

Highlighted text

image

Fleck now supports highlighted text found in the markdown source in the compiled html via the <mark></mark> tag:

Source:

this paragraph includes ==highlighted== text

Compiles to:

<p>this paragraph includes <mark>highlighted</mark> text

Strike trough text

image

Fleck now supports strike-through text found in the markdown source in the compiled html via the <s></s> tag:

Source:

this paragraph includes ~~strike-trough~~ text

Compiles to:

<p>this paragraph includes <s>strike-trough</s> text

Escape html

Instructs fleck to escape html elements encountered while lexing the markdown source.

fleck test.md
# 2023/05/04 19:41:44 info: compiled 'test.md', took: 459.166µs
fleck --escape-html test.md
# 2023/05/04 19:41:44 info: compiled 'test.md', took: 459.166µs

Consider the following snippet:

# This is the first heading

<h2 class="heading" id="this-is-the-second-heading">
  This is the second heading
</h2>

By default fleck will render it as follows:

not-escaped-html

But supplied with the --escape-html, fleck escapes the given html:

escaped-html

Config

this feature is notated in the version with conf.1

Fleck now accepts a new flag for better user experience. The --config flag and the fleck.json file were introduced due to the amount of options fleck accepts. To keep the cli experience neat fleck accepts options in the form of a json file if invoked with --config:

fleck --config
# 2023/05/19 07:48:52 info: got 'config' flag, reading options from 'fleck.json'
# 2023/05/19 07:48:52 info: {
#         "Flags": {
#                 "live-preview": true,
#                 "math": true,
#                 "syntax": true
#         },
#         "Args": null,
#         "Files": [
#                 "test.md"
#         ]
# }
# 2023/05/19 07:48:52 info: starting live preview
# 2023/05/19 07:48:52 info: listening on http://localhost:12345/test.html
# 2023/05/19 07:48:52 info: compiled 'test.md', took: 2.20946ms
# 2023/05/19 07:48:52 info: watching for changes...

Documentation:

Loads options and source files from the configuration file fleck.json. And acts as if the user specified these via the cli.

Example json:

{
  "sources": ["test.md"],
  "flags": ["syntax", "math", "live-preview"]
}

The above is equivalent to:

fleck -syntax -math -live-preview test.md

The flags array accepts all flags documented in Usage.md.

Changes

Empty source file

Previously, fleck issues a warning and exists when an empty source file was found, this was changed to simply ignoring the source file if it is empty:

fleck tester.md
# 2023/05/19 07:29:55 warn: file is empty, exiting.

Now:

fleck tester.md
# 2023/05/19 07:31:18 info: detected empty source file (tester.md), skipping

Fixes

Directory as source file

This release fixes a crash caused by invoking fleck with a directory:

fleck .
# panic: runtime error: index out of range [0] with length 0
#
# goroutine 6 [running]:
# github.com/xnacly/fleck/scanner.New({0x7ffd9b38733c?, 0x0?})
#         /home/teo/programming/fleck/scanner/scanner.go:37 +0x1bb
# github.com/xnacly/fleck/core.Run({0x7ffd9b38733c, 0x1})
#         /home/teo/programming/fleck/core/core.go:162 +0x387
# main.main.func1({0x7ffd9b38733c, 0x1})
#         /home/teo/programming/fleck/fleck.go:82 +0x3e5
# created by main.main
#         /home/teo/programming/fleck/fleck.go:56 +0x458
fleck .
# 2023/05/19 07:29:12 error: '.' is a directory
# exit status 1

parser assumes next token as language spec

A code block without an explicit language specification produced a bug
which resulted in the parser stripping the next character in the code
block, instead of assigning an empty string to the language. This was
fixed by checking if the language specification exists.

Previously:

```js
console.log("test")
\```
<pre>
    <code class="language-">
(&#34;test&#34;)
    </code>
</pre>

Now:

```js
console.log("test")
\```
<pre>
    <code class="language-">
    console.log(&#34;test&#34;)
    </code>
</pre>

Changelog

# git request-pull 0.0.3-alpha+math.1 https://github.com/xnacly/fleck
xnacly (24):
      feat(lexer): add tilde parsing for striketrough text
      feat(parser): StrikeTrough tag for code gen
      feat(parser): implemented striketrough text
      feat(lexer): add support for '='
      feat(parser): add support for highlighted text
      refactor(parser): removed unused parser.Parser methods
      build: update feature to highlight.1
      doc(README): updated features
      fix(cli): debug options logging
      doc: documented new '-escape-html' flag
      feat: add '-escape-html' option flag
      refactor(parser): replaced strikesthrough and highlight function
      chore: update testing
      fix(parser): html in code blocks
      fix(parser): parser assumes next token as language spec
      fix(parser): emphasis parsing
      chore: update feature to 'conf'
      feat(cli): GetConfigFromFile
      feat(cli): FleckConfig struct
      refactor(cli): replace stringify with json.Marshal
      feat: '-config' option
      refactor: remove duplicate ARGUMENTS logging
      chore: add fleck.json
      fix: index error if source file is a directory

 README.md                       |   2 ++
 build.conf                      |   2 +-
 cli/cli.go                      |  27 +++++++++++++++++++++++++--
 cli/constants.go                |  35 +++++++++++++++++++++--------------
 doc/Features.md                 |   5 +++++
 doc/Usage.md                    |  88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------
 doc/assets/escaped-html.png     | Bin 0 -> 8954 bytes
 doc/assets/not-escaped-html.png | Bin 0 -> 8542 bytes
 fleck.go                        |  29 +++++++++++++++++++++--------
 fleck.json                      |   4 ++++
 parser/parser.go                | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------
 parser/tags.go                  |  19 ++++++++++++++++++-
 scanner/scanner.go              |  12 ++++++++++--
 scanner/scanner_test.go         |  19 +++++++++++++++++--
 scanner/tests/markdown.md       |   4 +++-
 scanner/tokens.go               |   6 ++++++
 test.md                         |  29 ++++++++++++++++++++---------
 17 files changed, 298 insertions(+), 94 deletions(-)
 create mode 100644 doc/assets/escaped-html.png
 create mode 100644 doc/assets/not-escaped-html.png
 create mode 100644 fleck.json

0.0.3-alpha+math.1

02 May 13:27
Compare
Choose a tag to compare

This release introduces the --math option as well as multi file support.

Features

Multi file support

Fleck now accepts multiple files and compiles them in parallel, this should greatly increase performance for bigger markdown projects:

fleck README.md test.md
# 2023/05/02 15:24:15 info: compiled 'test.md', took: 4.9883ms
# 2023/05/02 15:24:15 info: compiled 'README.md', took: 4.8783ms

Latex math rendering

The --math flag instructs fleck to inject katex with an autoload script into the resulting html. This enables rendering of mathematical expressions typeset with latex.

fleck --math --syntax test.md

Inline and block math in the resulting html:

image

fleck --version
# fleck: [ver='bare:0.0.3-alpha+math.1'][buildAt='2023-05-02T15:04:07.643722'][buildBy='[email protected]']

Changes

compare changes

Enhancements

  • Add multi file support (ea59852)
  • cli: Add '--math' option (3c7761b)
  • scanner: Add '$' (DOLLAR) token to lexing (c3a011b)
  • parser: Math inline and block parsing (173bab8)
  • generator: Add katex injection script (cb97080)

Fixes

  • Bug with preprocessor and files with multiple dots (9752aac)

Build

  • Started working on python release system (631b56d)
  • Added bare build, better logs (5c6dec9)
  • Replaced Makefile with python script for release (0583125)
  • Fix build step feature in filename (64469ef)
  • Add .exe to windows executables (88761a1)

Chore

  • Bump-> 0.0.3-alpha+math.1 (c0fc37f)

Tests

  • scanner: Add '$' DOLLAR to lexing tests (c386d45)

0.0.2-alpha+livepreview.1

25 Apr 11:03
Compare
Choose a tag to compare

0.0.2-alpha+livepreview.1

This release introduces the --live-preview command as well as the --port command. The new live-preview mode recompiles the source on change and reloads the preview in the browser.:

fleck --live-preview README.md

live-preview

fleck --version
# fleck: [ver='0.0.2-alpha+livepreview.1'][buildAt='2023-04-25T12:47:52+0200'][buildBy='[email protected]']

compare changes

Enhancements

  • Live-preview WIP (9317f41)
  • Websocket connection for livepreview (f9c3fd5)
  • core: Open tab in default browser in live-mode (b0da1eb)
  • core: Add '--port' flag (1570018)
  • core: Error if tcp perm denied (75c662c)
  • parser: Improve quote parsing and design (ad42943)
  • parser: Add input type to TodoListItem (572ca2d)
  • parser: Check_next() + next() methods (8b26ea1)

Fixes

  • Live preview (f093c72)
  • parser: '-' (DASH) in line would create a line line (31d9307)
  • core: Missing assets in '--live-preview' mode (362237f)
  • Set log output from stderr to stdout (68ec6aa)
  • parser: Toc anchor for h1 links (a997014)
  • parser: Bug found in 22a5ab6 (a6189c6)
  • parser: Br tags right after a code block (c06555e)
  • Runtime error on empty file (f336a43)

Refactors

  • gen: Switched to default prism theme (3c9c1b9)
  • cli: Added argument parsing (6af5ead)
  • gen: Remove duplicate css (f42f23c)
  • parser: Remove lookahead() function (0fb0d3e)

Build

  • Increment version, switch feature tag (068fbba)

Chore

Styles

  • gen: Set list-style for toc to none (2678d06)

What's Changed

  • feat: websocket connection for live-preview by @Intevel in #1

New Contributors

0.0.1-alpha+syntax.1

19 Apr 11:22
Compare
Choose a tag to compare

This release introduces the --syntax flag. This flag tells fleck to include the prism sources, which provides syntax highlighting.:

fleck -syntax README.md

image

fleck --version
# fleck: [ver='0.0.1-alpha+syntax.1'][buildAt='2023-04-19T13:20:29+0200'][buildBy='[email protected]']

compare changes

🚀 Enhancements

  • cli: New '--syntax' option (0de49a3)

📦 Build

Full Changelog: 0.0.1-alpha+watch.2...0.0.1-alpha+syntax.1

0.0.1-alpha+watch.2

19 Apr 11:03
Compare
Choose a tag to compare
0.0.1-alpha+watch.2 Pre-release
Pre-release

compare changes

Enhancements

  • Laying foundation for live preview mode (774d7b6)
  • gen: Updated styling, add quote titles (ed0b549)
  • parser: Blockquote titles (7ce7333)

Fixes

  • parser: Code block language class (356fc76)

Build

  • Replace . with + in version (f14f869)

Tests

0.0.1-alpha+watch.1

19 Apr 05:56
Compare
Choose a tag to compare
0.0.1-alpha+watch.1 Pre-release
Pre-release

This release introduces the following new features:

  • --help flag which shows the help fleck displays when called without an argument
  • --watch flag which compiles the source file, enters an endless loop and waits until the user makes a change to the source file, if so fleck recompiles the source file

Changes:

compare changes

Enhancements

  • cli: '--help' flag (24654d8)
  • Watch mode '--watch' (59f7bc3)
  • core: Clear screen after recompile in watch mode (02f7d12)

Fixes

  • parser: Codeblock now supports inline '`' (0c62d3c)

Refactors

  • core: Split functions from main to core (824879a)

Build

  • Update feature in version (b224ca4)

0.0.1-alpha.1

17 Apr 07:34
Compare
Choose a tag to compare
0.0.1-alpha.1 Pre-release
Pre-release

0.0.1-alpha.1

This is a prerelease and not production ready.

...master

Enhancements

  • Main function (329a3cb)
  • util: Add print helpers (8521015)
  • Check if enough arguments, header file (82114dd)
  • Parsing italic and bold (829bb26)
  • Line & line_pos in Token struct (e9d2c0d)
  • Link & CodeBlock enum values with content (62a2a30)
  • Headers, codeblock, code inline, rulers (d161662)
  • Checklist item (91f5bff)
  • Parsing links (WIP) (655cf6c)
  • Init go module (3fd6735)
  • scanner: Tokens and Token struct (4235a0b)
  • scanner: Main markdown features (29c9aab)
  • Main call with argument (f5e6af9)
  • lexer: Add blockquote parsing (e37e776)
  • lexer: Exclude special chars from text token (6248ebe)
  • Add BANG token type (dd0e960)
  • scanner: Add '?' and 'include' token (34738da)
  • Argument parsing (a3afc8c)
  • Cli parsing using flag pkg (f785f2c)
  • Began work on preprocessor (50afa2c)
  • Add option to enable preprocessor (e021abc)
  • Add a logger (725c891)
  • preprocessor: Implemented macros (36a8037)
  • cli: Add more flags (30317f6)
  • scanner: Add TOKEN_SYMBOL_MAP (34f060a)
  • parser: Add structs, string representation (06bb328)
  • parser: Add parsing logic for headings (275f60b)
  • Only cleanup if preprocessor was enabled (8ce43e4)
  • cli: Add new '--toc' option (aa67d10)
  • parser: Add ids to headings (a7c0e70)
  • Implement inline & block code (30b0f90)
  • cli: Added '--minify' and '--toc-full' flags (d6d7747)
  • parser: Text structure (0abc029)
  • parser: Link, img, italic, bold parsing (c030108)
  • cli: Add cli.Flag.Requires field (5d79935)
  • Add html template (53f6132)
  • cli: Add '--no-template' option (b319f00)
  • Implement writing to template or file (6ba6770)
  • parser: Parsing quotes (ccdc7c7)
  • parser: QuoteContext param parser.code (fea4310)
  • parser: Implement parsing of lists WIP (ad3385a)
  • generator: Bug report link, build info (4148b6f)
  • Bare build (ed2a58e)
  • New '--no-prefix' option (43e3ad2)
  • cli: New '--debug' opt (2530648)
  • parser: Implemented lists (79560a4)
  • cli: --version option & PrintVersion cmd (fedef79)

Performance

  • scanner: Stringbuild decreases execution time by 27% (6820f37)
  • scanner: Specialchar check improved (83fd9e0)
  • scanner: Decreased runtime by 27% (647dacd)
  • scanner: Replaced hashmap with switch case (WIP) (c2ae203)
  • scanner: Skip empty lines, grow stringbuilder by default (ecfa70a)

Fixes

  • Tried fixing weird advance bug (66169a6)
  • Attempted to fix out of bounds error (3b4d96e)
  • Ignoring first character (4637d3f)
  • Ignoring newline (5cc43e4)
  • parser: Heading 1-6 parsing (50efd1f)
  • Horizontal ruler parsing (58d2f05)
  • TEXT token position value (0a9d09f)
  • scanner: Endless loop in Scanner.advanceLine (759211b)
  • parser: Image.String func (d7d78fd)
  • parser: GenerateToc heading numbers (59e95be)
  • scanner: Lexing empty lines (88b65ca)
  • parser: Adapted to introduction of EMPTYLINE (61b5ff3)
  • parser: Img() parsing issues (fce4cd5)
  • parser: Code() dash parsing bug (15baeaf)

Refactors

  • Remove util (050ebb0)
  • Switched to rust (76a1b4c)
  • Renamed parser.rs to scanner.rs (409c801)
  • Removed parsing logic (4b69262)
  • Remove cargo.toml (d233ade)
  • Switch from type def to uint (7521668)
  • Remove PERF comments (f5cb431)
  • scanner: Renamed NewScanner -> New; Parse -> Lex (723fd87)
  • Move macros to preprocessor (8f76917)
  • Reworked cli parsing (72b1559)
  • Moved ARGUMENTS to the cli pkg (bb2dca5)
  • preprocessor: Remove outdated log (302335a)
  • cli: Reworked cli output (58536ce)
  • scanner: Split PrintTokens into subfunc (b6fd8b9)
  • scanner: Add EOF token (9c6dbae)
  • scanner: Moved info logging to main (deeb28e)
  • cli: Split cli package into files (0f05137)
  • Minify by default, remove '--minify' opt (778a8b7)

Build

  • Add makefile (0f00e36)
  • Depend run on build, add clean target (48200cb)
  • Make file init (7ec66c6)
  • Add builds for windows, linux & darwin (4fd3636)
  • Replace ver feature separator (9ddb059)

Chore

  • Add gitignore (0797793)
  • Add html files to gitignore (9f61193)
  • Add link and image tests (4996516)
  • Add temp fleck files to gitignore (6622df1)

Tests

  • More examples (c6a32ad)
  • Scanner (00de618)
  • For all currently supported markdown features (e49086d)
  • scanner: Add an other italic test case (3b842ba)
  • Add more testing (4b7bb4b)
  • scanner: Missing EMPTYLINE's in expected tokens (eb502a3)
  • Add more md elements (25068aa)
  • scanner: Remove printing all tokens (7ebf212)

...

Read more