Pretty Diff beautifier for Unibeautify
npm install --global @unibeautify/beautifier-prettydiff
See unibeautify-cli
for details.
Pretty Diff beautifier for Unibeautify
Home Page: https://github.com/prettydiff/prettydiff/
License: MIT License
Pretty Diff beautifier for Unibeautify
npm install --global @unibeautify/beautifier-prettydiff
See unibeautify-cli
for details.
Describe the bug
The endif tag is removed by the formater when i press ctrl + shift + i to format on vs code.
To Reproduce
Steps to reproduce the behavior:
make a twig or html (configured as twig file) and put this in:
<a class="nav-link" {% if m.href is defined %} href="{{ m.href }}" {% endif %} {% if m.id is defined %} id="{{m.id}}" {% endif %}>
<i class="fa fa-icon"></i>
<p>{{ m.label }}</p>
</a>
Expected behavior
to not make anything
Actual
<a class="nav-link" {% if m.href is defined %} href="{{ m.href }}" {% endif %} {% if m.id is defined %} id="{{m.id}}">
<i class="fa fa-icon"></i>
<p>{{ m.label }}</p>
</a>
Error/Stack Traces
it just removes the second endif tag
System (please complete the following information):
Additional context
.unibeautifyrc.json config file:
{
"HTML": {
"indent_size": 1,
"indent_style": "tab"
}
}
Language: ColdFusion
Config:
{
"ColdFusion": {
"indent_comments": true,
"indent_style": "tab",
"indent_size": 1,
"max_preserve_newlines": 1,
"quotes": "none",
"wrap_line_length": 60,
"force_indentation": false,
"beautifiers": [
"Pretty Diff"
]
}
}
Input:
<cfform name="frm_coupon_list" method="post" action="/admin/coupons/">
<table width="100%" cellspacing="1" cellpadding="2" border="0" class="hover row-border stripe cell-border" id="maintbl">
<thead>
<tr>
<td>
Name</td>
<td>
Code</td>
<td>
Expiration Date</td>
</tr>
</thead>
<tbody><tr><td>hello</td><td>goodbye</td></tr></tbody></table></cfform>
Output: The example version is correct; that is, it is NOT putting a space in, but the actual product in VSCode does (e.g. name="frm_coupon_list" comes out as name=" frm_coupon_list ")
<cfform
name="frm_coupon_list"
method="post"
action="/admin/coupons/">
<table
width="100%"
cellspacing="1"
cellpadding="2"
border="0"
class="hover row-border stripe cell-border"
id="maintbl">
<thead>
<tr>
<td>
Name</td>
<td>
Code</td>
<td>
Expiration Date</td>
</tr>
</thead>
<tbody>
<tr>
<td>hello</td>
<td>goodbye</td>
</tr>
</tbody>
</table>
</cfform>
Expected behavior:
Go to http://prettydiff.com/
value1,value2,value3,value4,value5,value6
And the tests:
Summary of all failing tests
FAIL test/languages/csv.spec.ts
● should successfully beautify CSV text
TypeError: value.split is not a function
at Diff.Object.<anonymous>.lineDiff.tokenize (node_modules/diff/src/diff/line.js:7:32)
at Diff.diff (node_modules/diff/src/diff/base.js:28:39)
at diffLines (node_modules/diff/src/diff/line.js:31:71)
at structuredPatch (node_modules/diff/src/patch/create.js:11:16)
at Object.createTwoFilesPatch (node_modules/diff/src/patch/create.js:101:16)
at InlineFlagManager.get rawPatch [as rawPatch] (node_modules/unibeautify/src/InlineFlagManager.ts:56:7)
at InlineFlagManager.get patch [as patch] (node_modules/unibeautify/src/InlineFlagManager.ts:39:13)
at InlineFlagManager.get text [as text] (node_modules/unibeautify/src/InlineFlagManager.ts:17:13)
at beautifier.beautify.then.newText (node_modules/unibeautify/src/beautifier.ts:371:29)
Prettydiff does a much better job at beautifying Liquid than JS Beautify.
Once Unibeautify/unibeautify#63 is published to npm
dependencies
to beautifier dependencies: [
{
type: DependencyType.Node,
name: "PrettyDiff",
package: "prettydiff2",
}
],
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
@types/jest
, jest
, ts-jest
)package.json
read-pkg-up ^7.0.0
@types/node 12.20.55
@types/jest 24.9.1
jest 24.9.0
npm-run-all2 5.0.2
prettydiff 101.2.6
rimraf 3.0.2
ts-jest 24.3.0
tslint 5.20.1
tslint-clean-code 0.2.10
tslint-microsoft-contrib 6.2.0
typescript 3.9.10
unibeautify 0.17.1
unibeautify >= 0.11.2
prettydiff ^101.0.6
.travis.yml
node 8
node 10
A space is added after the @. The Code is not working after formatting and i don't see a configuration to disable adding the space.
Language: C#
Config:
{
"C#": {
"indent_comments": true,
"indent_style": "space",
"indent_size": 2,
"max_preserve_newlines": 10,
"quotes": "none",
"wrap_line_length": 80,
"break_chained_methods": false,
"multiline_ternary": "always",
"align_assignments": false,
"beautifiers": [
"Pretty Diff"
]
}
}
Input:
public test()
{
//Script wird gestartet
Process.Start(@"\\ATHENE\Users\frottmann\Desktop\testPolicy\PolicyTest.bat");
return null;
}
Output:
public test() {
//Script wird gestartet
**Process.Start(@ "\\ATHENE\Users\frottmann\Desktop\testPolicy\PolicyTest.bat");**
return null;
}
Expected behavior:
To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:
.travis.yml
If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.
Greenkeeper has checked the engines
key in any package.json
file, the .nvmrc
file, and the .travis.yml
file, if present.
engines
was only updated if it defined a single version, not a range..nvmrc
was updated to Node.js 10.travis.yml
was only changed if there was a root-level node_js
that didn’t already include Node.js 10, such as node
or lts/*
. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.For many simpler .travis.yml
configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Published to the old namespace - https://www.npmjs.com/package/prettydiff
The option names have changed to a uniform naming convention. The application is new and completely rewritten from scratch in TypeScript. I will be looking at how to integrate this back into the project.
Just starting to use Unibeauty for very chaotic old Coldfusion code that I got from a client. The code is complex and the existing formatting is quite chaotic so I really hope that this tool will help.
I just pasted a small piece of code into the Unibeautify Playground and find that the result gets indented more and more - it seems that HTML table cells aren't aligned under each other but each td gets indented so the indentation builds up. The same applies for tr rows.
Is there something I can do about it? Is there a way to configure the behaviour of 'Pretty Diff'? sorry if this is a stupid beginner question.
Here is more or less original code that shows what I mean. It contains Coldfusion but is mostly HTML, I called it ".htm" to make it visible.
-Michael
Take the following snippet for example:
<form id="searchFormContainer" [formGroup]="searchForm" class="flex-column"></form>
When running this through the playground, you can see that it ends up changing the case in [formGroup], resulting in:
<form id="searchFormContainer" [formgroup]="searchForm" class="flex-column"></form>
This completely breaks the compiler.
YAML:
HTML: beautifiers: - Pretty Diff - JS-Beautify wrap_attributes: force
Language: Java
Config:
{
"Java": {
"indent_comments": true,
"end_with_comma": false,
"indent_style": "space",
"indent_size": 2,
"break_chained_methods": false,
"max_preserve_newlines": 10,
"quotes": "none",
"space_after_anon_function": false,
"multiline_ternary": "never",
"align_assignments": false,
"wrap_line_length": 80,
"beautifiers": [
"Pretty Diff"
]
}
}
Input:
public class AA {
public static void main(String[] args) {
System.out.println(0L);
}
}
Output:
public class AA {
public static void main(String[] args) {
System.out.println(0 L);
}
}
Expected behavior:
the long 0L shouldn't be touched by the code beautifier, but instead, there is a forbidden space inserted between the "0" and the "L". Examples: the playground linked above, as well as a commit in my project thing (its a really small project i know), as well as the Travis CI build that failed for that commit
The config file used in my project is slightly different, here it is.
Other longs are also affected (like here).
https://github.com/prettydiff/prettydiff/blob/master/lib/options.js#L36-L619
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.