code-beautifier

1.1.0 • Public • Published

Code Beautifier

A code will let your code on website prettier

Method to use

Just add the code below in your javascript file

import { beautify } from 'https://cdn.jsdelivr.net/npm/code-beautifier@latest/beautify.js'

Below is the example code

In HTML file

<!DOCTYPE html>	
<html>
	<head>
	</head>
	<body>
		<pre id="source"></pre>
		<script type="module" src="./script.js"></script>
	</body>
</html>

In script.js

import { beautify } from 'https://cdn.jsdelivr.net/npm/code-beautifier@latest/beautify.js'

var code = `print('hello, world')`

beautify(code, 'source', 'python3');

Support Language

  • c++
  • python3
  • javascript
  • css

Export functions

  • beautify(code, target, lan, show_lan, show_copy): output the prettier code to element which "id" is target. return none.
  • get_lan_data(): return all the support language. return list.

Getting Error

Check if you type the language or id right.

If you cannot fix this report me an issue.

Readme

Keywords

Package Sidebar

Install

npm i code-beautifier

Weekly Downloads

3

Version

1.1.0

License

MIT

Unpacked Size

33 kB

Total Files

6

Last publish

Collaborators

  • revival0728