Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function renderPage(template, content, page, outputPath) {
// render full html page
const templateStandaloneResult = template({
content,
page,
publicPath: config.dist.publicPath,
});
// make it pretty
const html = beautifyHtml(templateStandaloneResult, { indent_size: 2 });
// output to disk
return new Promise((resolve, reject) => {
fs.writeFile(path.resolve(outputPath, `${page}.html`), html, 'utf-8', (err, res) => {
if (err) {
reject(err);
} else {
resolve(res);
}
});
});
}
getHTMLOutput() {
const { preview, beautifyOutput } = this.props
return beautifyOutput
? beautifyJS.html(preview.content, {
indent_size: 2, // eslint-disable-line camelcase
wrap_attributes_indent_size: 2, // eslint-disable-line camelcase
max_preserve_newline: 0, // eslint-disable-line camelcase
preserve_newlines: false, // eslint-disable-line camelcase
})
: preview.content
}
async function main() {
const { render, theme } = hane.runtime
const result = await render.feed('# Render test')
let html = await theme.render({
categories: [],
items: [
{
title: 'Hello World',
content: result,
pubDate: new Date().toString(),
},
],
tags: [],
})
if (hane.config.theme.beautify) {
html = beautify_html(html, { indent_size: 2 })
}
try {
await fs.mkdirAsync(distPath)
} catch (e) {}
await fs.writeFileAsync(path.join(distPath, 'index.html'), html)
console.log('done')
}
2
Jacob
Thornton
@fat
3
Larry the Bird
@twitter
<h4>Code</h4>
<pre> {beautify.html(tablecode)}
</pre>
<span>
<h2>Tabs</h2>
<h3>Horizontal</h3>
Tab 1 content
Tab 2 content
Tab 3 content
<h3>Vertical</h3></span>
function beautifyTemplate(template, lang, options) {
let result = ''
switch (lang) {
case 'pug':
result = pug(template, options.pug)
break;
default:
result = htmlBeautify(template, options.html)
}
return trim(result)
}
return __awaiter(this, void 0, void 0, function* () {
let data = yield util_1.Host.getExportHTML();
data = htmlHead + data + headTail;
codeMirror.setValue(js_beautify_1.html(data));
});
}
render() {
return (
<div>
<pre style="{{padding:"> {beautifyhtml(
ExampleSection.renderToStaticMarkup(this.props.element),
{indent_size: 2, unformatted: []}
)}
</pre>
<div>Renders to:</div>
<div style="{{marginTop:">
{this.props.element}
</div>
</div>
);
}
}
const prettyHTML = _.memoize(html => beautify.html(html, {
'indent_size': 2,
'indent_char': ' ',
'unformatted': ['a'],
'wrap_line_length ': 78,
'indent_inner_html': true
}));
plistFilenames.forEach((filename, index) => {
const indent = detectIndent(plistFiles[index]);
fs.writeFileSync(
path.join(programOpts.ios, filename),
stripIndents`
` +
"\n" +
beautify(
fs
.readFileSync(path.join(programOpts.ios, filename), "utf8")
.match(/[\s\S]*<\/dict>/)[0],
Object.assign(
{ end_with_newline: true },
indent.type === "tab"
? { indent_with_tabs: true }
: { indent_size: indent.amount }
)
) +
stripIndents`
` +
"\n"
);
});
});
<code>
<{'Col xs={6} xsOffset={6}'} /></code>
<code>
<{'Col md={6} mdPush={6}'} /></code>
<code>
<{'Col md={6} mdPull={6}'} /></code>
<h4>Code</h4>
<pre> {beautify.html(gridcode)}
</pre>
<span>
<h2>Colors</h2>
<h3>Main colors</h3>
<small>Hover for hexcode</small><br>
<div>
<span>
<span>#03A6D7</span></span></div>
<div>
<span>
<span>#546677</span></span></div>
<div>
<span>
<span>#629BAC</span></span></div></span>