Software Developer and Writer @oracle-devrel, mad coder, blogger, podcaster, cat lover. I mean, I like dogs… but they're not cats.
Also follow me on Mastodon!
License: MIT License
Software Developer and Writer @oracle-devrel, mad coder, blogger, podcaster, cat lover. I mean, I like dogs… but they're not cats.
Also follow me on Mastodon!
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
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
# 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.
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
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.
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\]
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>'
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:
- 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.
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)
When pressing the v
key.
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 ?
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
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:
I've created another example file that is attached (as a zip) to the issue.
sample-mdless-missing-header.md.zip
Thanks!
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>'
¯\_(ツ)_/¯
The --links
option doesn't seem to take effect; links are always displayed inline.
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
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¬
--------------------------------------------------------------------------------------------------------------------------------------
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.
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? 🙂
The message for both starts as which: no imgcat in (<all:the:paths>)
and it's the same thing for 'pager'. The app still works as expected otherwise, but this is kind of strange. I'm using urxvt in manjaro i3, and zsh.
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$
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
The same file viewed with mdless
within iTerm 3 beta shows several issues:
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):
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
Dear Brett,
Could you be so kind to generate .exe
for the rest of us who are mere Windows users w/o Ruby?
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
:
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.
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.
`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.
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 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:
If you remove the offending characters (parentheses and question marks in this example), you get the expected output:
I'm no whiz at the git bisect
ing, 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.
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?
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
)?
echo '*hello_bye*' | mdless -P
-> hellobye*
$ 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
Table should have got printed
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
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:
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.
a list of values could be set by the user in for example: ~/.mdlessconfig
The numbers in an enumerated environment are not set correctly:
should give
but mdless shows
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.
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
$
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.
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
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
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:
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):
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. :)
are there any reasons to use 80 as default width for rendering instead of getting current terminal width via system calls?
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!
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.
Hello,
I'm really enjoying mdless.
I noticed if I comment out a line in my markdown source, it still shows up in mdless output.
I've tried a couple of things as listed in https://stackoverflow.com/questions/4823468/comments-in-markdown but I still see the commented out line.
Is there any way to comment out lines so they don't show up in mdless output? :)
/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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.