Coder Social home page Coder Social logo

Run code blocks as scripts about saku HOT 2 OPEN

kt3k avatar kt3k commented on September 27, 2024
Run code blocks as scripts

from saku.

Comments (2)

abraverm avatar abraverm commented on September 27, 2024 1

The main difference between Unix based OS (Linux\Mac) and Windows is how they identify the file to be executable or interpreted. I think by default it could be a bash\batch script, for example:

yarn install

It will create a temporary file tmp32423.sh with executable bit (chmod +x) in Unix:

#!/bin/bash
yarn install

For Windows it will be tmp32423.bat:

yarn install

Then it will let the operating system to figure out the rest.
This can be extended to other types of scripts with Markdown highligh support, for example:

print('hello')

It will create a python file tmp3123.py on all operating systems. In Unix it will add executable bit and the content will have a starter:

#!/usr/bin/env python
print('hello')

I think this will cover most of the common cases.


That said, I like the idea of environment variable syntax support. With #28 it will reduce data duplication and have cleaner code blocks. I would suggest it will just look for specific word structurce, that is: <Capital var name>=<value>, to keep Markdown document flexibility. For example:

# build

> some description

To build .... `NODE_ENV=production` ... more text.

      npx browserify main.js

Another example:

# production

In production you need the following environment variables set:
 - NODE_ENV=production

## build

      npx browserify main.js

from saku.

kt3k avatar kt3k commented on September 27, 2024

I'm not sure whether this is possible in a cross-platform way. I'd like to keep saku as cross-platform as possible.

On the other hand, I'm planning to support sort of variable or environment variable in a new syntax.

# build
- NODE_ENV=production

    npx browserify main.js

(NODE_ENV=production is set as env var.)
This might solve your problem.

from saku.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.