Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function default_options() to beautifier.js #1364

Closed
tkrotoff opened this issue Mar 31, 2018 · 2 comments
Closed

Add function default_options() to beautifier.js #1364

tkrotoff opened this issue Mar 31, 2018 · 2 comments

Comments

@tkrotoff
Copy link

You can retrieve Beautifier default options using Python: opts = jsbeautifier.default_options(), not with JavaScript.

This would be useful for "complex" default options, example with beautifier.js source code for unformatted:

// beautifier.js simplified source code for unformatted
// https://github.com/beautify-web/js-beautify/blob/v1.7.5/js/src/html/beautifier.js#L93
defaultOptions.unformatted = [
  'a', 'abbr', 'area', 'audio', 'b', 'bdi', 'bdo', 'br', 'button', 'canvas', 'cite'
  // ...
];

If I want to remove (or add) some tags from the unformatted option I would like to write something like:

import { html_beautify, defaultOptions } from 'js-beautify';

const excludeButton = defaultOptions.unformatted.filter(tag => tag !== 'button');
const niceHtml = html_beautify(uglyHtml, { unformatted: excludeButton });
@bitwiseman
Copy link
Member

@tkrotoff Sounds great! Go for it.

@bitwiseman bitwiseman added this to the v1.7.x milestone Apr 2, 2018
@bitwiseman bitwiseman modified the milestones: v1.7.x, v1.7.6 May 21, 2018
@bitwiseman bitwiseman modified the milestones: v1.7.6, v1.7.x Jun 30, 2018
@bitwiseman
Copy link
Member

Fixed by #1568.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants