7 ms·
PowerShell and Markdown
- eltoozero 8y agoSo PowerShell has an integrated dingus[0] now eh? So, where’s the equivalent offline bash script zero dependency sed awk contraption that is the reason we don’t get “nice things” in our trusty workhorse shell. Or is the answer to “quick” offline markdown to html conversion on Mac/Linux “install pandoc”? [0]: https://daringfireball.net/projects/markdown/dingus https://daringfireball.net/projects/markdown/dingus
- toyg 8y agoThe whole point of markdown is that you don't need a renderer in terminals.
- JdeBP 8y agoApparently. * https://softwarerecs.stackexchange.com/a/172 https://softwarerecs.stackexchange.com/a/172 * https://stackoverflow.com/a/18517404/340790 https://stackoverflow.com/a/18517404/340790 Even though you and they missed that there is an off-line tool that is the basis for dingus. * https://daringfireball.net/projects/markdown/ https://daringfireball.net/projects/markdown/ * https://unix.stackexchange.com/questions/43669/ https://unix.stackexchange.com/questions/43669/
- DarkWiiPlayer 8y agoIt's 2018 and microsoft is still re-inventing the wheel in the most useless way possible. As a linux-user, I almost take it as a given that I can just display markdown in the terminal (in my case, using vim) and in the windows world it's apparently a totally new concept.
- evfanknitram 8y agoIn Windows there's been a lot less emphasis on the terminal since most functionality has only been configurable using the UI. This is changing now. Your post is a little like complaining over a functional programming language adding OO-features or vice versa and saying they are late to the party.
- DarkWiiPlayer 8y agoI'd agree with that if windows was less bloated. If it was an acceptable position that it never had good terminal support because it did one thing and did it well, and that thing happened to be GUI, then yes, why bloat it with useless shell features that their user base doesn't need. Instead, windows has always been filled with features nobody wants or needs (looking at you, Internet Explorer 10), and most of them are way larger and probably took more development effort than it would have been to just build a good terminal emulator.
- JdeBP 8y agoYou're rather missing the fact that Windows does not have a terminal I/O model. It has a console model. Consoles are what the 1960s terminal model evolved into during the 1980s; from firmware-mediated access to CGA, through the VIO+KBD+MOU subsystems of OS/2, to Windows NT console objects. * http://jdebp.info./FGA/tui-console-and-terminal-paradigms.html http://jdebp.info./FGA/tui-console-and-terminal-paradigms.ht...
- evfanknitram 8y agoYou are crazy if you think that more people would prefer a terminal emulator than a built in web browser in Windows. There's a reason most home users use Windows and not Ubuntu, and it's not spelled terminal.
- kierenj 8y agoSo you're saying they're bringing feature-parity to Windows, and improving the situation there, and that's useless? Run that by me again?
- koalalorenzo 8y agoPowerShell? More PainShell! :D
- hestefisk 8y agoIn other news, Windows PowersHell.
- wildebaard 8y agoWhile I get that it's easy to hate on and make fun of Microsoft, why not applaud them for making stuff like this that apparently is 'a given' in the linux-world. What's wrong with a good idea, even if, especially if, others are already doing it. It's not like stealing IP; it's about making tooling nicer. I for one actually like this (granted, I use PowerShell regularly).
- evfanknitram 8y agoMaybe same reason people going to a restaurant are more likely to write a review if they are disappointed? For every "this is lame" there are probably 50 "oh, neat" opinions but fewer of those bother to write comments. (The above is just a guess. I have zero scientific backing.)
- wildebaard 8y agoThat could be. I also have zero scientific backing for it but for me, I would probably not have commented and indeed thought "oh, neat!" had it not been for the negative comments already made. That is also because "oh, neat!" on its own is not a very useful comment to make on a site like this, imho.
- patrickk 8y agoFrom past experience conducting data analysis on customer survey responses, I can say that you typically get a "barbell distribution" - most responses are either very negative or very positive, with relatively little in the middle. If people were very disappointed or had their expectations exceeded, they tend to actually respond, if the experience is "meh", not so much.
- deleted 8y ago[deleted]
- DarkWiiPlayer 8y agoFor me it's no so much a "Microsoft is inferior because linux did this first" as it is "Why the hell are they only just copying this now?"
- nailer 8y agoRecent comparison of pwsh to bash - finding out if you have the compromised eslint plugin. It's a bit apples-to-oranges, also I would have used 'find -exec {}' in the bash example, but it's still interesting: bash (by Feross): find . -type d -name "eslint-scope" -print0 | xargs -n 1 -0 -I % sh -c "(cat %/package.json | npx json version) && echo '(at %)'" pwsh: $results = @{} ls -recurse -filter "eslint-scope" | foreach { $file = "${_}\package.json" $version = cat $file | convertfrom-json | select -ExpandProperty version $results.Add($file,$version) } echo $results | format-list I quite like the Powershell version, even though the syntax is unfamiliar. $results is a real hash object, the JSON tools are built in and formatting is up to you (you could have it output Excel or markdown if you wanted). I don't really like '_' as the iteration variable but otherwise I prefer it.
- brazzledazzle 8y agoYou can use $psitem instead of $_. I think (don’t quote me on it) it’s shorthand for CLI use. Kind of like `?` being `where` and `%` being `foreach`/`foreach-object`.
- userbinator 8y agoIt's interesting how different opinions on the syntax are --- the extreme verbosity and "general bureaucracy" of PS is one of the things that puts me off using it unless there's really no other way. It feels like a weird mix of C#/Java, perl, and bash. Reading-Lots-OfWords_With-CapitalisationLike-This is just plain annoying. Perhaps because it reminds me of posts on various forums from users who would capitalise the first letter of every word.
- oblio 8y agoYou're being unnecessarily mean. First of all, there's no _ in sight in regular identifiers (99,99%). They're always CamelCase and Kebab-Case when including the verbs. Secondly, it's case insensitive so you don't even need to go CamelCase. Just lowercase-itallthewaytothebank :D Thirdly, it depends on what you want to do. You can use $_ and % and various Perlish shorthands for faster CLI usage, but it's your call. You don't have to mix, you can go full C# and just use the names or go full Perl and use the shorthands, it's up to you. And fourthly, that bureaucracy makes things very discoverable. Now you're used to bash, but bash & ecosystem suck hard the first few months, until you accumulate the baggage, sorry, the knowledge to use them proficiently :)
- nailer 8y agoThis really needs a 'ConvertTo-Markdown' to match 'ConvertFrom'. In the same way we have ConvertTo-Json, ConvertTo-Html, ConvertTo-Csv, etc. That would allow your powershell script's object to be shown as pretty markdown tables.
- JdeBP 8y ago> Using Show-Markdown you can take markdown and display it as a VT100 encoded string right in the console. This is an erroneous description (which in fairness originated with Aditya Patwardhan of Microsoft not with the author of the headlined article here, who is just parrotting it). As Thomas Dickey points out, VT100s had no notion of multiple colours at all. This is not VT100. * https://github.com/PowerShell/PowerShell/pull/6926 https://github.com/PowerShell/PowerShell/pull/6926 * https://invisible-island.net/xterm/xterm.faq.html#what_vt220 https://invisible-island.net/xterm/xterm.faq.html#what_vt220 > It just feels… odd. M. Pleau rightly points out the odd division of labour in the commands, here. Oddly, the conversion command not only generates an abstract syntax tree object, it also (but optionally) renders that AST into HTML or text with ECMA-48+T.416 control sequences. The "show" command then picks one of those two renderings from its input. A more conventional division of labour would have been one tool to create the AST, another tool (or indeed tools) to render the AST into HTML and ECMA-48+T.416 text, and the usual already existing PowerShell tools to paginate/display HTML and ECMA-48+T.416 text. (I add T.416, by the way, because the examples include T.416 SGR control sequences for indexed colour. Interestingly, they use it for a reverse video effect, for which there already was an ECMA-48 control sequence: SGR 7/SGR 27.)
- kyleperik 8y agoI don't understand the usefulness of Microsoft investing time in writing a built in half finished markdown rendering engine. With Linux these things just pop up and get popular as people get used to them. Feels like Microsoft is trying to just woo developers on the fence.
- kyleperik 8y agoWhy is this getting down voted? I'm giving a valid point, and no one seems to have a rebuttal. Why would they make this?
- forgotpwd16 8y agoThis a preview version so half-baked features are to be expected. More to point, from the PR, according to one of the collaborators "[t]he goal here is to open the way for native supporting help files in Mardown format. So currently [they] only need "convert from Markdown" and rendering. Later [they] could add other cmdlets." It seems Microsoft plan is to make a `man` (or `info`?) system but using a sane language instead.
- kyleperik 8y agoThank you for the thorough explanation. Still seems odd, as markdown by definition isn't really meant to be displayed in a terminal. Markup: "the process or result of correcting text in preparation for printing." This further confirms my suspicions about Microsoft's motives. If they wanted to make a `man` system, they would have made one, instead of working on markdown in the terminal which sounds quite trendy amongst Linux users.
- brad0 8y agoThere's a great tool called mdv on macOS if you're interested in using this in the mac terminal https://github.com/axiros/terminal_markdown_viewer https://github.com/axiros/terminal_markdown_viewer
- forgotpwd16 8y agoIn a more general tone, is anyone using PowerShell on Linux? Indeed it has some good ideas going on and its syntax seems well received from its Windows users, but since having gone cross-platform I haven't seen any comments on using it on Linux besides plain comparing it to bash.