All Projects → zebzhao → indent.js

zebzhao / indent.js

Licence: MIT License
Pure code indentation for jsx, tsx, ts, js, html, css, less, scss.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to indent.js

lowcode
React Lowcode - prototype, develop and maintain internal apps easier
Stars: ✭ 32 (-41.82%)
Mutual labels:  jsx, code, tsx
Compile Hero
🔰Visual Studio Code Extension For Compiling Language
Stars: ✭ 169 (+207.27%)
Mutual labels:  less, jsx, pug
vuetify-tsx
Vuetify TSX is just a wrapper lib around vuetify components.
Stars: ✭ 20 (-63.64%)
Mutual labels:  jsx, tsx
vue3-jd-h5
🔥 Based on vue3.0.0, vant3.0.0, vue-router v4.0.0-0, vuex^4.0.0-0, vue-cli3, mockjs, imitating Jingdong Taobao, mobile H5 e-commerce platform! 基于vue3.0.0 ,vant3.0.0,vue-router v4.0.0-0, vuex^4.0.0-0,vue-cli3,mockjs,仿京东淘宝的,移动端H5电商平台!
Stars: ✭ 660 (+1100%)
Mutual labels:  jsx, tsx
bit-css
用原子类赋予元素属性,减少甚至不写css
Stars: ✭ 19 (-65.45%)
Mutual labels:  less, pug
Gulp Starter Kit
A simple Gulp 4 Starter Kit for modern web development.
Stars: ✭ 134 (+143.64%)
Mutual labels:  less, pug
ios-scriptable-tsx
在 vscode 上使用 typescript 和 jsx 开发 ios 小组件的小框架.基于 Scriptable app.
Stars: ✭ 113 (+105.45%)
Mutual labels:  jsx, tsx
emitty
A platform for finding dependencies between files and building tools for incremental compilation or build.
Stars: ✭ 69 (+25.45%)
Mutual labels:  less, pug
Dukpy
Simple JavaScript interpreter for Python
Stars: ✭ 296 (+438.18%)
Mutual labels:  less, jsx
vue-tsx-admin
基于typscript+jsx+vue+ant-design-vue+ant-design-pro的中后台模板
Stars: ✭ 53 (-3.64%)
Mutual labels:  less, jsx
generator-speedseed
Oriented to components, allow create/choice template, multiple configuration with easy maintenance
Stars: ✭ 13 (-76.36%)
Mutual labels:  less, pug
vite-vue-admin
🎉🎉使用Vite + Vue3 + TypeScript + Element-plus + Mock开发的后台管理系统🎉🎉
Stars: ✭ 97 (+76.36%)
Mutual labels:  jsx, tsx
Vscode Deploy Reloaded
Recoded version of Visual Studio Code extension 'vs-deploy', which provides commands to deploy files to one or more destinations.
Stars: ✭ 129 (+134.55%)
Mutual labels:  less, pug
Vs Deploy
Visual Studio Code extension that provides commands to deploy files of a workspace to a destination.
Stars: ✭ 123 (+123.64%)
Mutual labels:  less, pug
Prettier
Prettier is an opinionated code formatter.
Stars: ✭ 41,411 (+75192.73%)
Mutual labels:  less, jsx
element
Fast and simple custom elements.
Stars: ✭ 65 (+18.18%)
Mutual labels:  jsx, tsx
typesafe-templates
Template engine that leverages JSX to generate JavaScript code from TypeScript code files rather than text templates.
Stars: ✭ 27 (-50.91%)
Mutual labels:  jsx, tsx
generator-yeomify-landing
Yeoman generator for landing project powered by Gulp
Stars: ✭ 29 (-47.27%)
Mutual labels:  less, pug
Vscode Stylelint
A Visual Studio Code extension to lint CSS/SCSS/Less with stylelint
Stars: ✭ 260 (+372.73%)
Mutual labels:  less, jsx
md-editor-v3
Markdown editor for vue3, developed in jsx and typescript, dark theme、beautify content by prettier、render articles directly、paste or clip the picture and upload it...
Stars: ✭ 326 (+492.73%)
Mutual labels:  jsx, tsx

indent.js - pure code indentation for js, jsx, json, ts, tsx, html, css, less, scss

Build Status

Fast, minimalistic, pure code indentation. Indents JavaScript, JSON, JSX, Typescript, TSX, CSS, LESS, SCSS, and HTML. Unlike JSBeautify, which adds new lines when reformatting code and changes single line expressions, indent.js preserves new lines in when indenting it. Indent.js is coded with simple, but universal, and unopinionated rules.

Indent.js is thoroughly tested to make sure it correctly indents all styles, and types of code.

If you like this project please leave a star. Your support is greatly appreciated.

Online indent.js demo

You have following options to get indent.js:

  1. Install with bower: bower install indent.js
  2. Install with npm: npm install indent.js

Download

Usage

Browser Global

var indented = indent.js(code, {tabString: '\t'});
console.log(indented);

Browser using AMD

define(['indent'] , function (indent) {
    var indented = indent.js(code, {tabString: '\t'});
    console.log(indented);
});

Node/CommonJS

var indent = require('indent');
var indented = indent.js(code, {tabString: '  '});
console.log(indented);

ES6/ES2015 Modules

import indent from 'indent.js';

var indentedJs = indent.js(code);  // JSX as well
var indentedTs = indent.ts(code);  // TSX as well
var indentedCss = indent.css(code);
var indentedHtml = indent.html(code);

Projects using indent.js:

  1. Spck Editor - Full-fledged code editor for the web

API Reference

Methods

js(code: String, options: Object): String
ts(code: String, options: Object): String
css(code: String, options: Object): String
html(code: String, options: Object): String

Options

Field Type Description
tabString string String to indent the code with. Counts as 1 indent.
indentHtmlTag bool Whether to indent contents inside <html> tag or not. Valid only for html(...).

Languages not supported:

  1. CoffeeScript
  2. Pug

Getting the project

  1. Clone the repo.
  2. Run npm install to install dependencies
  3. Run npm test to run tests in tests folder
  4. Run npm run build to build the project
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].