Closed relativityboy closed 6 years ago
@relativityboy I did some experimenting on this issue. Here is a branch with some samples: https://github.com/TimCliff/devportal/tree/38_prettify_samples. Are any of these what you are looking for?
I have four sample outputs:
{{method.expected_response_json}}
{{method.expected_response_json | jsonify}}
{{method.expected_response_json | pretty_json }}
{{method.expected_response_json | neat_json }}
These output the following for account_history_api.get_transaction
:
1.
{"ref_block_num"=>0, "ref_block_prefix"=>0, "expiration"=>"1970-01-01T00:00:00", "operations"=>[], "extensions"=>[], "signatures"=>[], "transaction_id"=>"0000000000000000000000000000000000000000", "block_num"=>0, "transaction_num"=>0}
2.
{"ref_block_num":0,"ref_block_prefix":0,"expiration":"1970-01-01T00:00:00","operations":[],"extensions":[],"signatures":[],"transaction_id":"0000000000000000000000000000000000000000","block_num":0,"transaction_num":0}
3.
{
--
| "ref_block_num": 0,
| "ref_block_prefix": 0,
| "expiration": "1970-01-01T00:00:00",
| "operations": [
|
| ],
| "extensions": [
|
| ],
| "signatures": [
|
| ],
| "transaction_id": "0000000000000000000000000000000000000000",
| "block_num": 0,
| "transaction_num": 0
| }
4.
{
--
| "ref_block_num":0,
| "ref_block_prefix":0,
| "expiration":"1970-01-01T00:00:00",
| "operations":[],
| "extensions":[],
| "signatures":[],
| "transaction_id":"0000000000000000000000000000000000000000",
| "block_num":0,
| "transaction_num":0
| }
The third option uses JSON.pretty_generate
, which seems to be fairly standard. The fourth option uses JSON.neat_generate
, which is someone's custom library but seems to have some additional formatting options available: https://github.com/Phrogz/NeatJSON#options
I think @TimCliff's branch shows neat_json
as the best approach if we adopt one small change, add highlight
:
{% highlight json linenos %}{{method.expected_response_json | neat_json }}{% endhighlight %}
I looked at that but that funny outline looks a little silly. I am looking at some other options at the moment too, potentially javascript based plugins
Been fiddling and have this working at the moment.
<pre><code class="language-javascript line-numbers">var query = { tag: 'steemitblog', // This tag is used to filter the results by a specific post tag limit: 5 // This limit allows us to limit the overall results returned to 5 }; </code></pre>
@relativityboy @feruzm @inertia186
removed macspore d0d81b3e0660665a31233335bb2e9ce9a66506b3
Created Issue at #72
filter added: d75a13d08b28faa397d649c5a325e266161ea204
The Liquid json formatter leaves much to be desired. There doesn't appear to be a "pretty" option.
We want a colorized, well-formatted pretty print option that does not rely on .yml or .md formatting
Notes
highlighter rouge
. A search forhighlighter rouge jekyll
may yield information (speculation: could be as simple as css formatting once use with .yml is figured out)AC