Timeline for Print code-fenced sections of a Markdown document
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 23, 2018 at 15:44 | comment | added | wchargin |
It's fine for text after a closing backtick to not be printed—this is what my original implementation did. Technically, a closing code fence may only be followed by whitespace (demo), but this is the kind of restriction that I'm happy to drop. Regarding RS : it sounds like ^ is matching beginning-of-document, not beginning-of-line, which is only slightly surprising to me. Good to know, in any case.
|
|
May 23, 2018 at 7:46 | comment | added | oliv | @wchargin I don't get you comment I note that this also removes all text after the closing ``` All text after a closing should backtick should not be printed, or did I miss something? | |
May 23, 2018 at 7:27 | comment | added | oliv |
RS is by default set to \n which means every line is an awk record. Changing RS changes the meaning of ^ and $ because you possibly have multi-lines record (which is the case here). So you cannot use ^ in RS in this case, but you could use RS='\n```[a-z]*\n'
|
|
May 23, 2018 at 7:14 | comment | added | wchargin |
This is very cute. gawk is required so that a multi-character RS is treated as a regular expression, as opposed to having unspecified behavior, correct? (I note that this also removes all text after the closing ```, which is fine with me.) One question: why does using RS='^```[a-z]*\n' (added start-of-line anchor) not work?
|
|
May 23, 2018 at 7:00 | history | edited | oliv | CC BY-SA 4.0 |
added 33 characters in body
|
May 23, 2018 at 6:53 | review | First posts | |||
May 23, 2018 at 8:09 | |||||
May 23, 2018 at 6:50 | history | answered | oliv | CC BY-SA 4.0 |