prettify

Sublime Text 2 Code Formatting

為{幸葍}努か 提交于 2019-12-02 14:12:03
First let me say I come from a Microsoft background and Visual Studio is my bread and butter. It has a command (keybind is arbitrary) that auto-formats any code syntax. The same command works in HTML, CSS, Javascript, C#, etc. I have tried plugins for ST2 and so far I've found most don't work on a Windows box and if they do, it's for a very specific purpose like just Javascript. I have tried (and opened Issues where appropriate): https://github.com/victorporof/Sublime-HTMLPrettify https://github.com/jdc0589/JsFormat (this one actually works) https://github.com/welovewordpress/SublimeHtmlTidy

How to beautify/prettify a Json/JS file in a node.js script

感情迁移 提交于 2019-12-02 02:27:33
问题 I am searching a way to prettify Json files in a node.js script (not CLI). I found a lot of npm beautifier packages, but none that can simply beautify directly a file. There is esbeautifier that do what I am searching to do, but the exemples only shows CLI commands: https://github.com/royriojas/esbeautifier Is there a way to use it in a Javascript? 回答1: you can use the tool esformatter. edit by @jck: here is JS snippet that works using fs: var esformatter = require('esformatter'); var fs =

Display javascript as code snippet

巧了我就是萌 提交于 2019-12-01 16:27:12
What I'm trying to do is display a snippet of javascript on the page, and not have it run, just display as a code snippet for folks to copy. I load google's Prettify, then in the page I have this code: <pre class="prettyprint"> <script> $(document).ready(function(){ setTimeout(function(){ console.log('deleting cookie'); $.cookie('cookie',null,{domain: document.domain}); },1000); }); </script> </pre> But this code just executes and doesn't display the JS snippet. What am I missing here? You need to convert your < and > characters to HTML entities like so: <pre class="prettyprint"> <script> $

How to add line numbers to all lines in Google Prettify?

纵饮孤独 提交于 2019-11-29 22:51:34
I am using prettify: <pre class="prettyprint linenums"> some code </pre> It works but the line number show every 5 lines and not for every line. I am using these files <link href="../src/prettify.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="../src/prettify.js"></script> Basically at the end of this page http://google-code-prettify.googlecode.com/svn/trunk/styles/index.html you can see that I want, but I looked at that code and I can't figure it out. The root cause is list-style-type: none in prettify.css: /* Specify class=linenums on a pre to get line numbering

How to add line numbers to all lines in Google Prettify?

流过昼夜 提交于 2019-11-28 18:29:16
问题 I am using prettify: <pre class="prettyprint linenums"> some code </pre> It works but the line number show every 5 lines and not for every line. I am using these files <link href="../src/prettify.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="../src/prettify.js"></script> Basically at the end of this page http://google-code-prettify.googlecode.com/svn/trunk/styles/index.html you can see that I want, but I looked at that code and I can't figure it out. 回答1: The

How to get Google Prettify to render more like Visual Studio

久未见 提交于 2019-11-28 17:03:21
I'm using Googles excellent Code Prettify and I'm quite happy with it. But: Does anybody happen to have a alternate CSS stylesheet so it'll render a bit more like Visual Studios default coloring? Green comments, red text/strings, etc. Thomas Bonini It took me a while but I replicated exactly my Visual Studio's color configuration. Enjoy. .com { color: #008000; } .str, .tag { color: #A31515; } .kwd, .atv { color: #0000FF; } .typ { color: #2B91AF; } .lit, .atn { color: #FF0000; } .pun, .pln { color: #000000; } .dec { color: #800080; } Comments are green, strings/tags reddish, keywords blue,

How to use prettify with blogger/blogspot?

风格不统一 提交于 2019-11-28 02:59:08
I'm using blogger.com to host some texts on programming, and I'd like to use prettify (same as stackoverflow) to nicely colour the code samples. How do I install the prettify scripts into the blog domain? Would it be better (if indeed its possible) to link to a shared copy somewhere? I have webspace on a different domain. Would that help? Many thanks. When you make a new entry in blogger, you get the option to use HTML in your entry and to edit your blog entries. so type http://blogger.com , then login, then Posting>Edit Posts>Edit then in there put this at the top: <script type="text

How to get Google Prettify to render more like Visual Studio

依然范特西╮ 提交于 2019-11-27 10:08:19
问题 I'm using Googles excellent Code Prettify and I'm quite happy with it. But: Does anybody happen to have a alternate CSS stylesheet so it'll render a bit more like Visual Studios default coloring? Green comments, red text/strings, etc. 回答1: It took me a while but I replicated exactly my Visual Studio's color configuration. Enjoy. .com { color: #008000; } .str, .tag { color: #A31515; } .kwd, .atv { color: #0000FF; } .typ { color: #2B91AF; } .lit, .atn { color: #FF0000; } .pun, .pln { color:

Generate pretty diff html in Python

丶灬走出姿态 提交于 2019-11-27 00:07:27
问题 I have two chunks of text that I would like to compare and see which words/lines have been added/removed/modified in Python (similar to a Wiki's Diff Output). I have tried difflib.HtmlDiff but it's output is less than pretty. Is there a way in Python (or external library) that would generate clean looking HTML of the diff of two sets of text chunks? (not just line level, but also word/character modifications within a line) 回答1: There's diff_prettyHtml() in the diff-match-patch library from

How to use prettify with blogger/blogspot?

百般思念 提交于 2019-11-26 23:54:45
问题 I'm using blogger.com to host some texts on programming, and I'd like to use prettify (same as stackoverflow) to nicely colour the code samples. How do I install the prettify scripts into the blog domain? Would it be better (if indeed its possible) to link to a shared copy somewhere? I have webspace on a different domain. Would that help? Many thanks. 回答1: When you make a new entry in blogger, you get the option to use HTML in your entry and to edit your blog entries. so type http://blogger