Giter Site home page Giter Site logo

mdless's Introduction

🥃 Brett Terpstra

Software Developer and Writer @oracle-devrel, mad coder, blogger, podcaster, cat lover. I mean, I like dogs… but they're not cats.

total stars total stars followers followers

 ttscoff ttscoff

Connect With Me

ttscoff ttscoff linkedin

Also follow me on Mastodon!

mdless's People

Contributors

adrian-gierakowski avatar cumminsc9 avatar dependabot[bot] avatar eliten00b avatar joast avatar rfdonnelly avatar ttscoff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mdless's Issues

mdless prints a list of pagers after quitting

After I hit q to exit out of mdless , I see a list of pagers. Do I need to configure something to make this go away?

$ mdless CHANGELOG.md
/usr/bin/less
/usr/bin/less
/bin/more
/bin/cat
/usr/bin/pager
$

Here's my version:

$ mdless --version
mdless 0.0.9

Run on windows

Hello,

dou you provide a windows executable?
This would be very nice to have, since not all windows users have ruby installed.

Kind regards
Andi

Indenting of heading list does not account for length of index

# a
## b
## c
## d
## e
# f
## g
## h
## i
## j
## k
## l

Running mdless -lP headings.md gives.


1: a
2: ..- b
3: ..- c
4: ..- d
5: ..- e
6: f
7: ..- g
8: ..- h
9: ..- i
10: ..- j
11: ..- k
12: ..- l

note how j, k, and l are all shifted over an extra space. With the ..s hidden when on a colour terminal, it can appear at first glance that there is an additional level in the heirarchy.

Unrecognized character \x1B;

Just installed (with gem install). I tried a couple of files, but I get:

$ cat notes/README.md 
# linux_notes #

Repository of helpful linux notes and cheatsheets, mainly for a terminal environment.
$ mdless --debug 4 notes/README.md 
I, [2019-09-04T12:32:50.061264 #28983]  INFO -- : Processing "notes/README.md"
Unrecognized character \x1B; marked by <-- HERE after <-- HERE near column 1 at - line 3.
cat notes

mdless adds blank lines before and after content

Hello,

Thanks for a great tool! Very useful.

Why are there blank lines inserted in mdless output before and after the main content?

For example:

[root@localhost source]# cat /tmp/example.md
# header

text
[root@localhost source]# mdless /tmp/example.md

header ============================================================================================================================================================================================================

text




[root@localhost source]#

Put another way:

[root@localhost source]# wc -l /tmp/example.md
3 /tmp/example.md
[root@localhost source]# mdless /tmp/example.md | wc -l
8
[root@localhost source]#

The extra blank lines at the bottom are causing content to scroll off my screen.

Escaped characters not displaying correctly

0.0.10
According to https://dillinger.io/ the following:
\[ \] \*
should show in the following way:
[ ] *
Instead it remains:
\[ \] \*

Example Markdown where error was originally detected:

# Documento para el proyecto1
## Analizador Lexicoo
### Lenguaje C-

Un documento con:
o Las expresiones regulares para detectar todos los tokens.

o El DFA implementado que realiza la detección de tokens.

### Descripcion Tecnica
La implementacion se hizo por estados con una hash table que tiene el estado y el token como llave regresando el sig estado

### Deteccion de errores
Para parsear simplemente se purgara el caracter que ocasiono el error y se imprimira los caracteres que se esperaban en vez de este

### Lexico de C--

Nota: la notacion [abcde..] es equvalente a (a|b|c|d|e).
Se ha escrito de esta forma para facilitar la lectura

Palabras reservadas: else if int return void while
simbolos especiales: + - * / < <= > >= == != = ; , ( ) [ ] { } /* */

ID= letra letra*
NUM= digito digito*
letra = [a-zA-z]
digito = [0-9]

espacios en blanco = n|r|t|s|
comentarios comienzan con G* terminan con *g y no hay andacion

Regex para detectar ID
[0123456789]\[0123456789\]\*
Regex para detectar id
[abcdefghijklomnñopqrstuvwxyz]\[abcdefghijklomnñopqrstuvwxyz\]

Issue when resizing terminal window smaller after initial load

I seem to have an issue if I resize the terminal window smaller than it was on initial load. Using iTerm2 3.0.2. Possibly related to #3?

/Users/domster83/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:417:in `*': negative argument (ArgumentError)
    from /Users/domster83/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:417:in `block (2 levels) in convert_markdown'
    from /Users/domster83/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:413:in `map'
    from /Users/domster83/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:413:in `block in convert_markdown'
    from /Users/domster83/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:393:in `gsub!'
    from /Users/domster83/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:393:in `convert_markdown'
    from /Users/domster83/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:117:in `block in initialize'
    from /Users/domster83/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:105:in `each'
    from /Users/domster83/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:105:in `initialize'
    from /Users/domster83/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mdless-0.0.9/bin/mdless:17:in `new'
    from /Users/domster83/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mdless-0.0.9/bin/mdless:17:in `<top (required)>'
    from /Users/domster83/.rbenv/versions/2.3.1/bin/mdless:22:in `load'
    from /Users/domster83/.rbenv/versions/2.3.1/bin/mdless:22:in `<main>'

Different emphasis delimiters

Currently, emphasis is started and ended with either '*' or '_', but the same character should be needed.

Input:
*foo_bar*

Expected result:
<em>foo_bar</em>

Actual result:
<em>foo</em>bar*

From v0.28 of the CommonMark Spec:

  1. Emphasis begins with a delimiter that can open emphasis and ends with a delimiter that can close emphasis, and that uses the same character (_ or *) as the opening delimiter.

support for opening file in editor using ```v``` key

Not sure if a bug or a non implemented feature.

When using less you can open the file in the default text editor by pressing the v button. and on exit of the text editing it returns to less.

It would be great to add this to mdless for quick editing of files.

Currently I am getting the error message Cannot edit standard input (press RETURN)
image

When pressing the v key.

Problem with converting on Pop!_OS 20.04 LTS

System: Pop!_OS 20.04 LTS
I try to test "mmdless" and during installation saw:

Successfully installed mdless-1.0.14
invalid options: -ri
(invalid options are ignored)
Parsing documentation for mdless-1.0.14
Installing ri documentation for mdless-1.0.14
Done installing documentation for mdless after 0 seconds
1 gem installed

(before I had to install ruby)

But than:

$ mdless Vim.md 

^CTraceback (most recent call last):
	8: from /usr/local/bin/mdless:23:in `<main>'
	7: from /usr/local/bin/mdless:23:in `load'
	6: from /var/lib/gems/2.7.0/gems/mdless-1.0.14/bin/mdless:17:in `<top (required)>'
	5: from /var/lib/gems/2.7.0/gems/mdless-1.0.14/bin/mdless:17:in `new'
	4: from /var/lib/gems/2.7.0/gems/mdless-1.0.14/lib/mdless/converter.rb:121:in `initialize'
	3: from /var/lib/gems/2.7.0/gems/mdless-1.0.14/lib/mdless/converter.rb:121:in `each'
	2: from /var/lib/gems/2.7.0/gems/mdless-1.0.14/lib/mdless/converter.rb:134:in `block in initialize'
	1: from /var/lib/gems/2.7.0/gems/mdless-1.0.14/lib/mdless/converter.rb:578:in `convert_markdown'
/var/lib/gems/2.7.0/gems/mdless-1.0.14/lib/mdless/converter.rb:578:in `gsub!': Interrupt

What do i wrong ?

Stalls when trying to display doing files

mdless stalls when attempting to render doing markdown files.

also tried with cat.
script freezes, then upon Ctrl + C I get this message:

  ~/.rvm/gems/ruby-2.3.1/gems/mdless-0.0.10/lib/mdless/converter.rb:338:in `sub!': Interrupt
  from ~/.rvm/gems/ruby-2.3.1/gems/mdless-0.0.10/lib/mdless/converter.rb:338:in `convert_markdown'
  from ~/.rvm/gems/ruby-2.3.1/gems/mdless-0.0.10/lib/mdless/converter.rb:118:in `block in initialize'
  from ~/.rvm/gems/ruby-2.3.1/gems/mdless-0.0.10/lib/mdless/converter.rb:106:in `each'
  from ~/.rvm/gems/ruby-2.3.1/gems/mdless-0.0.10/lib/mdless/converter.rb:106:in `initialize'
  from ~/.rvm/gems/ruby-2.3.1/gems/mdless-0.0.10/bin/mdless:17:in `new'
  from ~/.rvm/gems/ruby-2.3.1/gems/mdless-0.0.10/bin/mdless:17:in `<top (required)>'
  from ~/.rvm/gems/ruby-2.3.1/bin/mdless:23:in `load'
  from ~/.rvm/gems/ruby-2.3.1/bin/mdless:23:in `<main>'
  from ~/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
  from ~/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'

* while trying to render my doing file as an Übersicht widget

`mdless` v1.0.2 rendering of headers issues when there's no "H1" header

Hi,

Just testing the new version of mdless (v1.0.2), I've found it has some issues for showing header levels when the files does not a "H1" (single #) line.

If the file has level 2 (##) or level 3 (###) headers, they are shown like normal lines, but with one "hash" less on the line.

So, this text:

Sample text
## Level 2
some text
### Level 3
some more text

is shown like this:

image

I've created another example file that is attached (as a zip) to the issue.

sample-mdless-missing-header.md.zip

Thanks!

mdless 1.0.3 won't load any files: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- mdless/hash (LoadError)

I've just updated to the latest version of mdless, v1.0.3, and now I can't load any file, or even call it without any params.

I've updated with:

$ sudo gem update mdless
Updating installed gems
Updating mdless
Fetching: mdless-1.0.3.gem (100%)
Successfully installed mdless-1.0.3
invalid options: -ri
(invalid options are ignored)
Parsing documentation for mdless-1.0.3
Installing ri documentation for mdless-1.0.3
Installing darkfish documentation for mdless-1.0.3
Done installing documentation for mdless after 0 seconds
Parsing documentation for mdless-1.0.3
Done installing documentation for mdless after 0 seconds
Gems updated: mdless

And then trying to invoke mdless for anything (mdless <filename>, or mdless --help or even just mdless) gives the same error:

mdless
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- mdless/hash (LoadError)
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /Library/Ruby/Gems/2.3.0/gems/mdless-1.0.3/lib/mdless.rb:9:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:39:in `require'
	from /Library/Ruby/Gems/2.3.0/gems/mdless-1.0.3/bin/mdless:3:in `<top (required)>'
	from /usr/local/bin/mdless:22:in `load'
	from /usr/local/bin/mdless:22:in `<main>'

¯\_(ツ)_/¯

nagative aurument in converter.rb:417

jinyuj-m01:cloudml-dist-mnist-example jinyuj$ mdless /Users/jinyuj/Workspace/tensorflow/cloudml-dist-mnist-example/README.md
/Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:417:in *': negative argument (ArgumentError) from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:417:in block (2 levels) in convert_markdown'
from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:413:in map' from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:413:in block in convert_markdown'
from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:393:in gsub!' from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:393:in convert_markdown'
from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:117:in block in initialize' from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:105:in each'
from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/lib/mdless/converter.rb:105:in initialize' from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/bin/mdless:17:in new'
from /Users/jinyuj/.rvm/gems/ruby-2.3.0/gems/mdless-0.0.9/bin/mdless:17:in <top (required)>' from /Users/jinyuj/.rvm/gems/ruby-2.3.0/bin/mdless:23:in load'
from /Users/jinyuj/.rvm/gems/ruby-2.3.0/bin/mdless:23:in <main>' from /Users/jinyuj/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in eval'
from /Users/jinyuj/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `

'

So, the problem is that in line 417, the code use a nagative number * a string, commonly, "ha"*3 means we will get "hahaha" as the result. But if the number is a nagetive number, there will be an error of it. The problem is that in line 417, the (@cols - orig_length) get an nagetive number when I am using this. please help to figure this out : )
README.md.txt

Greater than & space in front of code block content & line break symbol at the end of line

OS: Fedora 32

When reading files with code blocks I can't copy the content because of the extra greater than & space in front of code block content & line break symbol at the end. Is there a way to disable this? if not, please add this feature.

--[ code ]----------------------------------------------------------------------------------------------------------------------------
> some commad¬                                                                                                     
> some other commad¬                                                                                                     
--------------------------------------------------------------------------------------------------------------------------------------

Remove dependency on git

If git is not installed on a system but you try to run mdless, you get the following error:

$ mdless README.md 
Traceback (most recent call last):
	10: from /usr/local/bin/mdless:23:in `<main>'
	 9: from /usr/local/bin/mdless:23:in `load'
	 8: from /var/lib/gems/2.5.0/gems/mdless-0.0.10/bin/mdless:17:in `<top (required)>'
	 7: from /var/lib/gems/2.5.0/gems/mdless-0.0.10/bin/mdless:17:in `new'
	 6: from /var/lib/gems/2.5.0/gems/mdless-0.0.10/lib/mdless/converter.rb:121:in `initialize'
	 5: from /var/lib/gems/2.5.0/gems/mdless-0.0.10/lib/mdless/converter.rb:737:in `printout'
	 4: from /var/lib/gems/2.5.0/gems/mdless-0.0.10/lib/mdless/converter.rb:692:in `page'
	 3: from /var/lib/gems/2.5.0/gems/mdless-0.0.10/lib/mdless/converter.rb:692:in `fork'
	 2: from /var/lib/gems/2.5.0/gems/mdless-0.0.10/lib/mdless/converter.rb:700:in `block in page'
	 1: from /var/lib/gems/2.5.0/gems/mdless-0.0.10/lib/mdless/converter.rb:745:in `which_pager'
/var/lib/gems/2.5.0/gems/mdless-0.0.10/lib/mdless/converter.rb:745:in ``': No such file or directory - git (Errno::ENOENT)

I suspect this is because you're checking the git config for a pager, but ideally the program would skip this step if it can't find git, rather than crashing. The reason this matters is when you're in a minimal environment, e.g. a VPS or a docker container, where you need to quickly view a markdown file but you don't want to have to install git.

New release

Hi! I'm about to use this tool (thanks!) but I noticed there haven't been releases since Jan 2018, whereas there seem to be a few juicy PRs. Would you mind cutting another release? 🙂

Ubuntu 18.04: cannot compile binary

Previous git sources allowed me to generate mdless binary.
Now I only get errors:
Please give me a hint how to compile mdless binary!


leder@leder-ryzen-home:~/Git/mdless$ bundle update
The gemspec at /home/leder/Git/mdless/mdless/mdless.gemspec is not valid. Please fix this gemspec.
The validation error was 'metadata['homepage_uri'] has invalid link: "TODO: Put your gem's website or public
repo URL here."'
leder@leder-ryzen-home:~/Git/mdless$ gem build mdless.gemspec 
WARNING:  See http://guides.rubygems.org/specification-reference/ for help
ERROR:  While executing gem ... (Gem::InvalidSpecificationException)
    ["bin/mdless"] are not files
leder@leder-ryzen-home:~/Git/mdless$ gem install mdless
Done installing documentation for  after 0 seconds
leder@leder-ryzen-home:~/Git/mdless$ 

Rendering issue

This is a super neat tool! Just what I needed!

I have a weird rendering issue though, and would appreciate any pointers to fix it. Code text appears outlined which makes it very difficult to read.

I am using Hyper 3 on macOS Mojave with zsh and Menlo as the font.

Screen Shot 2019-11-12 at 10 23 10 AM

Thanks!

`mdless` not properly showing code blocks

Hi!

I've just installed mdless and I've noticed there seem to be some issues with the way that code blocks are shown. I have Pygments installed, and (apparently; not very familiar with it) working:

test$ pygmentize -V
Pygments version 2.0.2, (c) 2006-2014 by Georg Brandl.

I've created a test file but due to GitHub's funky Issues app not allowing attachments, I've posted it as a gist (https://gist.github.com/jjarava/9596855f9f1ff9720167).

For reference, this is how the example file looks when viewing it on Marked - notations 1, 2 and 3 work fine

mdless-example-marked-2015-09-07_17-46-08

The same file viewed with mdless within iTerm 3 beta shows several issues:

mdless-example-mdless-iterm3-beta-2015-09-07_18-10-46

Running the same file through pygmentize via cat mdless-sample-test.md | pygmentize shows that the syntax highlighting is working (or at least the script would recognize quite a few of the snippets):

mdless-example-raw-pygmentize-2015-09-07_18-13-45

Any hints or workarounds more than welcome; personally I'm quite partial to the triple backtick notation in my .md files and I've got more than a few code samples scattered in my files...

Regards

[EXPIRED] Windows binary

Dear Brett,
Could you be so kind to generate .exe for the rest of us who are mere Windows users w/o Ruby?

headers broken after newline and EOF

Given two commands, the first ending in newline and the second with more text; only the the second will print a header.

$ echo '#h1
' | ./mdless -P ; echo '#h1
hello' | ./mdless -P

gives (extra blank lines removed):

#h1 

h1 ======================================================================================================================
hello

I do not know if this intentional but in my mind markdown tags stand alone without context. And Github seems to agree with me (see very last line showing same idea).

In any case when this line https://github.com/ttscoff/mdless/blob/develop/lib/mdless/converter.rb#L190:

headers = input.scan(/^((?!#!)(\#{1,6})\s*([^#]+?)(?: #+)?\s*|(\S.+)\n([=-]+))$/i)

is changed to:

headers = input.scan(/^((?!#!)(\#{1,6})\s*([^#]+?)(?: #+)?[ \t]*|(\S.+)\n([=-]+))$/i)

(last \s changed to [ ^t]) fixes my test case.

Although I dont know if that causes any other repercussions.

Github rendering of # test\nEOF:

test

mdless (1.0.5) exiting with no output on OSX 10.15 (previously worked)

I was using mdless for a few weeks and it's suddenly started exiting with no output. Tried the -d flag but the only output is:

~ > mdless -d test.md
Error: Log level out of range (1-4)

Any idea what might be going on? Would love to track down the error and get back to using it.

'bundle exec rake' on a fresh clone gives a backtrace (cannot load 'test-unit')

I'm using the built-in Ruby 2.3.x on macOS 10.14 (Mojave), with only the bundler and mdless gems installed in my user directory.

I just want to run the tests for mdless without installing any gems in my user or system lib directories. What I tried:

git clone https://github.com/ttscoff/mdless.git
bundle install --path vendor/bundle
bundle exec rake

…expecting the test target to run.

What I got instead was a backtrace: `require': cannot load such file -- test/unit
$ bundle exec rake
/Users/myuser/devel/util/mdless/test/test_helper.rb:1:in `require': cannot load such file -- test/unit (LoadError)
	from /Users/myuser/devel/util/mdless/test/test_helper.rb:1:in `'
	from /Users/myuser/devel/util/mdless/test/default_test.rb:1:in `require'
	from /Users/myuser/devel/util/mdless/test/default_test.rb:1:in `'
	from /Users/myuser/devel/util/mdless/vendor/bundle/ruby/2.3.0/gems/rake-0.9.6/lib/rake/rake_test_loader.rb:15:in `require'
	from /Users/myuser/devel/util/mdless/vendor/bundle/ruby/2.3.0/gems/rake-0.9.6/lib/rake/rake_test_loader.rb:15:in `block in '
	from /Users/myuser/devel/util/mdless/vendor/bundle/ruby/2.3.0/gems/rake-0.9.6/lib/rake/rake_test_loader.rb:4:in `select'
	from /Users/myuser/devel/util/mdless/vendor/bundle/ruby/2.3.0/gems/rake-0.9.6/lib/rake/rake_test_loader.rb:4:in `'
rake aborted!
Command failed with status (1): [ruby -I"lib:test" -I"/Users/myuser/devel/util/mdless/vendor/bundle/ruby/2.3.0/gems/rake-0.9.6/lib" "/Users/myuser/devel/util/mdless/vendor/bundle/ruby/2.3.0/gems/rake-0.9.6/lib/rake/rake_test_loader.rb" "test/default_test.rb" ]
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `load'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `kernel_load'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in `run'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/cli.rb:476:in `exec'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/exe/bundle:46:in `block in '
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors'
/Users/myuser/.gem/ruby/2.3.0/gems/bundler-2.1.4/exe/bundle:34:in `'
/Users/myuser/.gem/ruby/2.3.0/bin/bundle:22:in `load'
/Users/myuser/.gem/ruby/2.3.0/bin/bundle:22:in `'
Tasks: TOP => default => test
(See full trace by running task with --trace)

I very obviously have the test-unit gem (3.1.5) available as a part of the OS-default Ruby installation:

$ gem which test-unit
/Library/Ruby/Gems/2.3.0/gems/test-unit-3.1.5/lib/test-unit.rb

It's possible I just don't understand Ruby, bundler, or gems, because I don't know why bundle exec wouldn't just use that one.

Emphasis not recognized when preceded by punctuation

Fails to recognize emphasis when preceded by punctuation such as an opening quotation mark or parenthesis. Other implementations such as GitHub recognize this properly.

Test cases: Some of these work in mdless 0.0.10, some don't

*blah**“blah”*
*blah “blah”*
*“blah” blah*
(*“blah”*)
(*“blah”* blah)
(blah *“blah”*)
(“*blah*”)
(“*blah*” blah)
(blah “*blah*”)
"*blah*"
*"blah"*
*blah "blah"*
*"blah" blah*
(*"blah"*)
(*"blah"* blah)
(blah *"blah"*)
("*blah*")
("*blah*" blah)
(blah "*blah*")
“**blah****“blah”**
**blah “blah”**
**“blah” blah**
(**“blah”**)
(**“blah”** blah)
(blah **“blah”**)
(“**blah**”)
(“**blah**” blah)
(blah “**blah**”)
"**blah**"
**"blah"**
**blah "blah"**
**"blah" blah**
(**"blah"**)
(**"blah"** blah)
(blah **"blah"**)
("**blah**")
("**blah**" blah)
(blah "**blah**")
“_blah__“blah”_
_blah “blah”_
_“blah” blah_
(_“blah”_)
(_“blah”_ blah)
(blah _“blah”_)
(“_blah_”)
(“_blah_” blah)
(blah “_blah_”)
"_blah_"
_"blah"_
_blah "blah"_
_"blah" blah_
(_"blah"_)
(_"blah"_ blah)
(blah _"blah"_)
("_blah_")
("_blah_" blah)
(blah "_blah_")
“__blah____“blah”__
__blah “blah”__
__“blah” blah__
(__“blah”__)
(__“blah”__ blah)
(blah __“blah”__)
(“__blah__”)
(“__blah__” blah)
(blah “__blah__”)
"__blah__"
__"blah"__
__blah "blah"__
__"blah" blah__
(__"blah"__)
(__"blah"__ blah)
(blah __"blah"__)
("__blah__")
("__blah__" blah)
(blah "__blah__")

Headlines with parentheses, question marks not parsed as headlines

Headlines that contain certain characters (which look like they could be regex metacharacters) do not get parsed as headlines. I haven't done an exhaustive search, but I've noticed that parentheses and question marks are among the characters that cause this.

I'm using version 1.0.9 freshly installed with gem install on macOS Mojave (10.14), with the built-in Ruby 2.3.7something.

Given this input, I expect all three headlines to be parsed correctly:

mdless <(echo "# A header (with parentheses)

Words.

## a subheader - with a question mark?

Words, words.

## a subheader with no funny stuff

Words, words, words.")

…but only the third headline "a subheader with no funny stuff" actually is. The output looks like this:

test_with_funny_chars_thumb

If you remove the offending characters (parentheses and question marks in this example), you get the expected output:

test_no_funny_chars_thumb

I'm no whiz at the git bisecting, but I'm pretty sure this behavior didn't exist a year or so ago, when I was using mdless to run terminal-based "slideshows" for a workshop.

hiliteCode undefined method split

just installed and tried mdless
and got

/Library/Ruby/Gems/2.3.0/gems/mdless-0.0.12/lib/mdless/converter.rb:324:in `hiliteCode': undefined method `split' for nil:NilClass (NoMethodError)
	from /Library/Ruby/Gems/2.3.0/gems/mdless-0.0.12/lib/mdless/converter.rb:457:in `block in convert_markdown'
	from /Library/Ruby/Gems/2.3.0/gems/mdless-0.0.12/lib/mdless/converter.rb:437:in `gsub!'
	from /Library/Ruby/Gems/2.3.0/gems/mdless-0.0.12/lib/mdless/converter.rb:437:in `convert_markdown'
	from /Library/Ruby/Gems/2.3.0/gems/mdless-0.0.12/lib/mdless/converter.rb:118:in `block in initialize'
	from /Library/Ruby/Gems/2.3.0/gems/mdless-0.0.12/lib/mdless/converter.rb:106:in `each'
	from /Library/Ruby/Gems/2.3.0/gems/mdless-0.0.12/lib/mdless/converter.rb:106:in `initialize'
	from /Library/Ruby/Gems/2.3.0/gems/mdless-0.0.12/bin/mdless:17:in `new'
	from /Library/Ruby/Gems/2.3.0/gems/mdless-0.0.12/bin/mdless:17:in `<top (required)>'
	from /usr/local/bin/mdless:22:in `load'
	from /usr/local/bin/mdless:22:in `<main>'

any clue how to fix it?

Light color scheme

Currently the colored output is very hard to read on a light background.
It would be nice to have support for at least two color schemes.
Perhaps store pererences in a config file (~/.mdlessrc)?

Table not getting printed

Current Behavior

$ mdless << 'EOT'

   - Use git stash when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away and reverts the working directory to match the HEAD commit.
   - Calling `git stash` without any arguments is equivalent to `git stash push`.
   - The modifications stashed away by this command can be listed with `git stash list`, inspected with `git stash show`, and restored (potentially on top of a different commit) with `git stash pop`
   - The latest stash you created is stored in `refs/stash`; older stashes are found in the reflog of this reference and can be named using the usual reflog syntax (e.g. `stash@{0}` is the most recently created stash, `stash@{1}` is the one before it, `stash@{2.hours.ago}` is also possible). Stashes may also be referenced by specifying just the stash index (e.g. the integer `n` is equivalent to `stash@{n}`).
 
   Table: Command
 
   Command                 |  Purpose
   ------------------------|--------------------
   -s or --save            | stash all including untracked and ignored files
   ------------------------|--------------------
   -l or --list            | list all stashes
   ------------------------|--------------------
   -r or --restore         | restore stash "${2:-0}" (Default the last stash, i.e. 0)
   ------------------------|--------------------
 
EOT



    - Use git stash when you want to record the current state of the working directory and the index, but want to
go back to a clean working directory. The command saves your local modifications away and reverts the working
directory to match the HEAD commit.
    - Calling `git stash` without any arguments is equivalent to `git stash push`.
    - The modifications stashed away by this command can be listed with `git stash list`, inspected with `git
stash show`, and restored (potentially on top of a different commit) with `git stash pop`
    - The latest stash you created is stored in `refs/stash`; older stashes are found in the reflog of this
reference and can be named using the usual reflog syntax (e.g. `stash@{0}` is the most recently created stash,
`stash@{1}` is the one before it, `stash@{2.hours.ago}` is also possible). Stashes may also be referenced by
specifying just the stash index (e.g. the integer `n` is equivalent to `stash@{n}`).

    Table: Command

Expected behavior

Table should have got printed

Crash on github-compatible markdown

Trying to run mdless on github-compatible markdown, for example the yii2 README crashes almpost instantly:

$ mdless tmp/README.md 
Yii 2 Advanced Project Template is a skeleton [Yii 2](http://www.yiiframework.com/) application best for
developing complex Web applications with multiple tiers.
/usr/local/lib64/ruby/gems/1.9.1/gems/mdless-0.0.8/lib/mdless/converter.rb:421:in `*': negative argument (ArgumentError)
    from /usr/local/lib64/ruby/gems/1.9.1/gems/mdless-0.0.8/lib/mdless/converter.rb:421:in `block (2 levels) in convert_markdown'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/mdless-0.0.8/lib/mdless/converter.rb:417:in `map'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/mdless-0.0.8/lib/mdless/converter.rb:417:in `block in convert_markdown'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/mdless-0.0.8/lib/mdless/converter.rb:397:in `gsub!'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/mdless-0.0.8/lib/mdless/converter.rb:397:in `convert_markdown'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/mdless-0.0.8/lib/mdless/converter.rb:120:in `block in initialize'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/mdless-0.0.8/lib/mdless/converter.rb:108:in `each'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/mdless-0.0.8/lib/mdless/converter.rb:108:in `initialize'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/mdless-0.0.8/bin/mdless:17:in `new'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/mdless-0.0.8/bin/mdless:17:in `<top (required)>'
    from /usr/local/bin/mdless:23:in `load'
    from /usr/local/bin/mdless:23:in `<main>'

EDIT: revelant env is:

COLUMNS=92
LANG=en_US.utf8
LESS='-R -M --shift 5'
LESSOPEN='|lesspipe %s'
LINES=31
PAGER=/usr/bin/less
SHELL=/bin/bash
TERM=rxvt-unicode-256color

Can't change colour of text under headers

Consider the following markdown:

Before heading - this text looks fine on a white background.

# Heading 1

Here is some text - looks too pale on a white background

## Heading 2

Here is some more text - also looks too pale on a white background

Here is how it displays in Terminator on Ubuntu 18.04:

mdless

I would like to make the text under the headings darker, but cannot figure out which setting I need to change to do this. What HTML element do they correspond to?

Thanks.

Enumeration doesn't work

The numbers in an enumerated environment are not set correctly:

  1. Item1
  2. Item2
  3. Item3

should give

  1. Item1
  2. Item2
  3. Item3

but mdless shows

  1. Item1
  2. Item2
  3. Item3

mdless not showing code blocks at all

In mdless this :

Vérifier que les sous-modules Git ont bien été clonés :

```
git submodule update --init
```

Would show as

image

I'm using iTerm2 build 3.2.5 with mdless 0.0.12

Setext-style headers unsupported

Setext-style headers are not displayed like ATX-style ones. They also seem to break parsing or output… in my case the last paragraph is sent to stdout, not to the pager.

Fenced code blocks render as empty

When viewing a file with mdless, code blocks render without any text in them:

$ cat foo.md
```python
def foo(bar):
    print("yay!")
```

$ mdless foo.md
--[ python ]-------------------------------
-------------------------------------------

macOS version: 10.14
Ruby version: 2.5.1
iTerm2 version: 3.3.6
What didn't work: Everything seems in order except the fenced code blocks for me, with/without pygments installed.
What I tried: Installing pygments, trying a few files with different programming languages represented, removing ~/.config/mdless/mdless.theme
Am I using a custom theme: nope

$ cat ~/.config/mdless/mdless.theme
--- default

$

Standard Theme Presets

It will be great to have standard theme presents for popular colour schemes like Solarized Dark, Solarized Light.

It will be good to have this as a part of the repositories so that it will be easier for users to switch to standard themes.

tab separated output is ignored

Hello ttscoff,

I know of markdown tables, but is it wanted that tab separated output with ´less´ is converted to a single whitespace with ´mdless´?

Cheers
Gerrit

macOS 10.15.3 - failing with "syntax error, unexpected $end, expecting ')'"

Fresh install on macOS 10.15.3. Any attempt to run, including mdless -h fails with:

`%mdless -h

/opt/local/lib/ruby/gems/1.8/gems/mdless-1.0.10/lib/mdless/converter.rb:254: warning: don't put space before argument parentheses
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require': /opt/local/lib/ruby/gems/1.8/gems/mdless-1.0.10/lib/mdless/converter.rb:254: unknown type of %string (SyntaxError) ...h ('%3d: %s' % [idx + 1, c(%i[x black])+"."*level+c(%i[x yel... ^ /opt/local/lib/ruby/gems/1.8/gems/mdless-1.0.10/lib/mdless/converter.rb:254: syntax error, unexpected $end, expecting ')' ...h ('%3d: %s' % [idx + 1, c(%i[x black])+"."*level+c(%i[x yel... ^ from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in require'
from /opt/local/lib/ruby/gems/1.8/gems/mdless-1.0.10/lib/mdless.rb:11
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in require'
from /opt/local/lib/ruby/gems/1.8/gems/mdless-1.0.10/bin/mdless:3
from /opt/local/bin/mdless:19:in load' from /opt/local/bin/mdless:19

Escape codes visible in code block

Hello,

Just started using mdless. Really excited to adopt this tool, I plan to use this to teach a class, my materials are in Markdown format and I can use mdless to render them for the students live.

Small problem -- I am seeing escape codes in the code block:

image

This is with mdless 1.0.15.

pygments has my code language:

[root@ip-172-31-16-17 source]# pygmentize -L | grep cfengine
* cfengine3, cf3:
[root@ip-172-31-16-17 source]#

I am on Windows 10, and the above screenshot is in Windows Terminal. I have the same issue in the Windows console (what I get when I run bash.exe):

image

Is it me? Or is it something in mdless?

Here is my source file (just take out the backslashes), to reproduce:

The promise type is always followed by a single colon.


\```cfengine3
files:

    "/etc/nologin"

        create  => "true",
        comment => "Prevent non-root users from logging in";
\```

If I run mdless with --no-color, the escape codes disappear -- but I want the color. :)

No license specified

Hi, would you please consider adding an open source LICENSE file to this project? I am interested in using it, but I am restricted from doing so without an explicit license specified by the project. Thank you!

Images in text using chafa

Not a bug, more a feature request or an idea. There is the excellent image rendering program called 'chafa' that converts images to text representations. It works pretty well for me in the default settings. This could be used if installed to render images more terminal independent (albeit at worse quality) than the iterm option does.

Invalid option -i

/Library/Ruby/Gems/2.0.0/gems/mdless-0.0.8/lib/mdless/converter.rb:97:in `initialize': invalid option: -i (OptionParser::InvalidOption)
from /Library/Ruby/Gems/2.0.0/gems/mdless-0.0.8/bin/mdless:17:in `new'
from /Library/Ruby/Gems/2.0.0/gems/mdless-0.0.8/bin/mdless:17:in `<top (required)>'
from /usr/local/bin/mdless:23:in `load'
from /usr/local/bin/mdless:23:in `<main>'

mdless -v gives mdless 0.0.8 by Brett Terpstra

Using iterm2 Build 2.9.20160102

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.