sc0ttj / mdsh

A simple static site generator, using Markdown and Bash
https://sc0ttj.github.io/mdsh/
10 stars 0 forks source link

Subshell using other langs #76

Closed sc0ttj closed 5 years ago

sc0ttj commented 5 years ago

This PR adds (possibly buggy) support for embedding code in your Markdown other than Bash... So in addition to <?bash echo foo ;?>, Here is the full list:

to test it out

I tested these by running some "hello world" stuff in an example Markdown file:

### python

Here is `<?python print 'SOME "PYTHON"' ;?>` in a sentence.

And a python block:

    ```python
    <?python
    print 'wo"r"ld';
    ;?>

perl

Now some <?perl print 'PERL "stuff"'; ;?> in a sentence.

And a Perl block:

```python 
<?perl
print 'perl-lo';
print 'wo"r"ld';
;?>
```

Node JS

Node <?node console.log("in a"); ;?> sentence.

Node block:

```javascript
<?node
console.log("hell world!");
;?>
```

bash

Your date is <?bash date ;?>.

Your PWD is <?bash echo $PWD | grep mdsh ;?>

Your user is <?bash whoami ;?>. Your OS is <?bash uname ;?> and Pkg version is <?bash pkg -v | cut -f2 -d' ' ;?>.

I have a small script I use to quickly load whatever SNES, PlayStation (etc) ROMs I wanna play.

It uses rofi, the desktop launcher, and mednafen the mutli-system emulator.

I have added key bindings so I can hit Ctrl-SPACE and start typing a system (PSX, SNES, etc), then hit ENTER and start typing a game name, then hit ENTER again to play :)

As you can see from the default ROM dir I have set at the top of the script, it loads ROMs over the local network just fine.

Here is the script:

```shell
<?bash
cat /root/bin/rofnafen.sh;
;?>
```


:)