learnbyexample / Command-line-text-processing

:zap: From finding text to search and replace, from sorting to beautifying text and more :art:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Complex character class description as code

teeks99 opened this issue · comments

In gnu_grep.md (around line ) and gnu_sed.md (around line 1402) there is an example of equalivent word and space character classes. Unfortunately these are valid-ish markdown, and so do not get rendered correctly. They should be escaped as code in both places.

This:

| Character classes | Description |
| ------------- | ----------- |
| \w | Same as [0-9a-zA-Z_] or [[:alnum:]_] |
| \W | Same as [^0-9a-zA-Z_] or [^[:alnum:]_] |
| \s | Same as [[:space:]] |
| \S | Same as [^[:space:]] |

Should be this:

| Character classes | Description |
| ------------- | ----------- |
| `\w` | Same as `[0-9a-zA-Z_]` or `[[:alnum:]_]` |
| `\W` | Same as `[^0-9a-zA-Z_]` or `[^[:alnum:]_]` |
| `\s` | Same as `[[:space:]]` |
| `\S` | Same as `[^[:space:]]` |

The ticks around the slash classes aren't necessary for formatting, but I think are good style (elsewhere in the document these are generally formatted as code).

For consistency and clarity, it might also make sense to apply this pattern to the table a couple paragraphs above this. I don't see any markdown issues there, but I think it would generally be clearer to list the actual regex patterns as code.

do not get rendered correctly

can you post a snapshot of what you are seeing?

I think I'd agree with you that showing these within backticks would be better for clarity..

I guess the issue is only showing up in the gitbook render, there must be a small difference between that markdown engine and github's.

For some reason, I can't get my screenshot to upload in here, hopefully you can see it on the gitbook render.

yeah, I've observed gitbook and github rendering not matching before... thanks for spotting and reporting this one..

I've changed it now