[dev] smu CommomMark improvements

2019-10-09 Thread Karl Bartel
Hi,

After reading the point "Improve the Markdown parser used by the
suckless wiki called "smu" to conform more to Markdown" on
https://suckless.org/project_ideas/ I fixed a few incompatibilities
that turned up when comparing smu against
https://github.com/michelf/mdtest. The results can be found at
https://github.com/karlb/smu. If anyone gives it a try, please let me
know about the results!

Regards,
Karl



Re: [dev] smu CommomMark improvements

2019-10-09 Thread Karl Bartel
Hi Ciprian,

Since I only wrote some recent commits and never spoke to the original
author, my knowledge is only some guesswork from reading the code. So
my answers are not as precise as I'd like them to be.

> * is the proposed markup compliant with CommonMark as implemented by
> https://github.com/commonmark/cmark ?

smu only takes a subset of CommonMark, but if you use that, the output
is intended to be the same. However, I didn't test it, so it's
probably not not really the case.

> (i.e.  if so, which is the syntax that is common in both generators,
> `smu` and `cmark`?)

Everything in the readme as well as in the tests directory should give
the same result with smu and other commonmark compatible parsers. If
it doesn't, feel free to create an issue.

> * are code-blocks as separated by  on each line supported?  (the
> issue with codeblocks as indented by spaces is that one can't easily
> copy-paste those in the shell or plain-text editor without removing
> the indentation;)

I just pushed basic support for this. It works if you use exactly
three backticks and don't use language info strings. So
```
your code here
```
should be fine.

> * reading the readme as rendered by GitHub, it is misleading,
> especially regarding the quoting syntax;  perhaps it would be better
> to put it as an plain `.txt` file which is much more readable;

Thanks for the heads up! I'll have a look at the problem. Ideally, the
output would be identical for both smu and github. If I can't get them
to behave the same, I'll rename to just README.

Thanks for the feedback,
Karl



[dev] [smu] Updated smu ready for suckless.org?

2020-04-30 Thread Karl Bartel
Hi everyone!

I tried to get the task "Improve the Markdown parser used by the
suckless wiki called 'smu' to conform more to Markdown" from
https://suckless.org/project_ideas/ done. You can find a summary of
the differences introduced by me in the README. It's mostly "code
fences and better CommonMark compatibility".

The code is at https://github.com/karlb/smu and rendered versions of
the suckless wiki can be found at
http://static.karl.berlin/smu-preview/ . One case where my version
already yields a visible improvement with the current markup are some
code blocks:
Before: https://dwm.suckless.org/patches/moveresize/index.html
After: 
http://static.karl.berlin/smu-preview/dwm.suckless.org/patches/moveresize/

I've looked through a bunch of pages and the results look good to me,
although there are some cases where the improved CommonMark
compatibility causes minor problems. One such case can be seen in the
example above, where an unintended paragraph is inserted between
"dwm.c" and "after" because the list indentation is wrong (the second
line should have three spaces):

1. Put the following `moveresize()` function somewhere in your `dwm.c`,
  **after** the line which includes the config.h file:

I'd like to move this forward and get the task checked off the project
ideas page. Let me know what should be the next step.

Karl

PS: If anyone has specific markup snippets they want to work
differently, let me know, even if it's unrelated to the suckless wiki!



Re: [dev] [smu] Updated smu ready for suckless.org?

2020-04-30 Thread Karl Bartel
Hi Hiltjo!

On Thu, Apr 30, 2020 at 12:47 PM Hiltjo Posthuma  wrote:
> On a quick glance I see that the numbered bullet items are not incremented on
> your version anymore:
>
> > After: 
> > http://static.karl.berlin/smu-preview/dwm.suckless.org/patches/moveresize/

This happens because each of the list items is in a separate list,
making the numbering restart from one. Since the lines between the
list items are not indented by three spaces, there is not way to treat
this as a single list while conforming to CommonMark, if I understand
the list handling specs correctly.
The input leading to this can be seen at
https://git.suckless.org/sites/file/dwm.suckless.org/patches/moveresize/index.md.html.

But there is a good solution to make this example work: Implement the
list start number behavior[1] from the CommonMark spec, so the even
though these items are treated as different lists, each item will get
the intended number. So far, smu always started counting from 0. I'll
do that if nobody voices an opposing opinion.

> Can you try to get the improvements upstream to Gottox (if you haven't tried 
> it
> already of course).

I've created two PRs[2][3] last September but I didn't receive any
feedback on them. So I didn't see a point in creating more PRs.

Thanks for the feedback,
Karl

[1] https://spec.commonmark.org/0.29/#start-number
[2] https://github.com/Gottox/smu/pull/10
[3] https://github.com/Gottox/smu/pull/11



Re: [dev] [smu] Updated smu ready for suckless.org?

2020-05-06 Thread Karl Bartel
On Thu, Apr 30, 2020 at 5:48 PM Karl Bartel  wrote:
> But there is a good solution to make this example work: Implement the
> list start number behavior[1] from the CommonMark spec, so the even
> though these items are treated as different lists, each item will get
> the intended number. So far, smu always started counting from 0. I'll
> do that if nobody voices an opposing opinion.

I went with this approach and the numbering is now as expected:
http://static.karl.berlin/smu-preview/dwm.suckless.org/patches/moveresize/

If anyone finds other cases where output gets worse, please let me know!

Anything else I can do to prepare this for being used at suckless.org?

Karl