Sublime Text Xml
Browse

SublimeLinter-xmllint This linter plugin for SublimeLinter provides an interface to xmllint. It will be used with files that have the “XML” syntax. A collection of DocBook XML snippets for Sublime Text 2 and 3 What does this do? This repo contains snippets that help automate syntax generation for technical writers and developers writing content in DocBook XML. They are specifically designed for a text editor called Sublime Text, but are compatible with others that use snippets.

Prettify/Minify/Query/Goto/Validate/Lint JSON plugin for Sublime Text 2 & 3

Labelsjson, pretty, lint, minify, validate, query, json2xml

Installs

  • Total797K
  • Win327K
  • Mac341K
  • Linux128K
Jan 8Jan 7Jan 6Jan 5Jan 4Jan 3Jan 2Jan 1Dec 31Dec 30Dec 29Dec 28Dec 27Dec 26Dec 25Dec 24Dec 23Dec 22Dec 21Dec 20Dec 19Dec 18Dec 17Dec 16Dec 15Dec 14Dec 13Dec 12Dec 11Dec 10Dec 9Dec 8Dec 7Dec 6Dec 5Dec 4Dec 3Dec 2Dec 1Nov 30Nov 29Nov 28Nov 27Nov 26Nov 25Nov 24
Windows176211204229209769261132189188209837914417618721222570101210265228233229838423924220724920989912322532122532808191213236247238
Mac175232251278205776245139180210171718010815420026921888932112623062992651038926628230428628286852552932762722378971204231304280
Linux55576870523529202453574530242736656668303561667582712025718286857334246476808680253277867288

Readme

Source
raw.​githubusercontent.​com

Prettify/Minify/Query/Goto/Validate/Lint JSON plugin for Sublime Text 3 & 4

Installation

Text

Package Control (Recommended)

Install this sublime text ¾ package via Package Control search for package: “Pretty JSON

Manual Installation

Sublime Text 4

  • cd <Packages directory> (MacOS: ~/Library/Application Support/Sublime Text/Packages)
  • git clone https://github.com/dzhibas/SublimePrettyJson.git 'Pretty JSON'

Sublime Text 3

  • cd <Packages directory> (MacOS: ~/Library/Application Support/Sublime Text 3/Packages)
  • git clone https://github.com/dzhibas/SublimePrettyJson.git 'Pretty JSON'
  • cd Pretty JSON
  • git checkout st3

Sublime Text 2No longer supported

Usage

To prettify JSON, make selection of json (or else it will try to use full view buffer) and press keys:

  • Linux: ctrl+alt+j
  • Windows: ctrl+alt+j
  • OS X: cmd+ctrl+j

or through Command Palette Ctrl+Shift+P find “Pretty JSON: Format JSON” (you can search for part of it like 'pretty format')

If selection is empty and configuration entry use_entire_file_if_no_selection is true, tries to prettify whole file

If JSON is not valid it will be displayed in status bar of Sublime Text

Sublime Text Xml

Validate JSON

Using Command Palette Ctrl+Shift+P find “Pretty JSON: Validate” (you can search for partial string 'validate') this will validate selection or full file and will show in dialog if it's valid or invalid. In case of found errors view will jump to error and will highlight it

Compress / Minify JSON

Using Command Palette Ctrl+Shift+P find “Pretty JSON: Minify JSON” (you can search for part of it like 'json minify') this will make selection or full buffer as single line JSON which later you can use in command lines (curl/httpie) or somewhere else…

To map a key combination like Ctrl+Alt+M to the Minify command, you can add a setting like this to your .sublime-keymap file (eg: Packages/User/Default (Windows).sublime-keymap):

Convert JSON to XML

Using Command Palette Ctrl+Shift+P search for “Pretty JSON: json2xml” (you can search for part of it like '2XML') this will convert your selected JSON of full buffer to XML and replace syntax and buffer to XML output

./jQ query/filter usage

Demo:

If on your machine “./jq” tool is available with ctrl+atl+shift+jyou can run against your json. output will be opened in new view so you can once again apply jq on new buffer

You can find instructions of tool here:

Default configuration

  • use_entire_file_if_no_selection

    • Default: true
  • indent

    • Default: 2
    • Integer represents amount of spaces
    • t will utilize a tab character
  • sort_keys

    • Default: false
  • ensure_ascii

    • Default: false
  • line_separator

    • “,”
  • value_separator

    • “: ”
    • Value separator in config, so if you need to get rid of extra space you can remove it with this param
  • keep_arrays_single_line

    • Default: false
    • If we need to re-structure arrays and make them single-line
  • max_arrays_line_length

    • Default: 120
    • If array for example '[“a”, “b”, 123213, ….]' length will reach max it will be kept multi-line
  • pretty_on_save

    • Default: false
    • Do we need to automatically Pretty JSON on save
  • validate_on_save

    • Default: true
    • Do we need validate JSON files on each save
  • reindent_block

    • Default: false
    • If we are formatting a selection, if we need to reindent theresulting block to follow the flow of the source documentthe posible values are 'minimal' and 'start'

    using minimal, the resulting json lines are indented as much spaces as the line where the selection starts. e.g

    gets formatted as:

    using start, the resulting json lines are indented a numberof spaces equal to the column number of the start of the selection

    with start the previous example gets formatted as:

Using tabs for indentation

You can change configuration key indent to string value 't' or any other string

Be sure 'Indent Using Spaces' is unchecked otherwise you will not see effect and ST3/4 will convert it back to spaces

Contributors

Others

If you YAMLing then maybe you interested in this plugin: PrettyYAML

Sublime Xml Format

If you build your project in Maven and use Sublime Text for coding, this trick may be useful. I assume you have Package Control already installed.

Sublime Text C++ Packages

First, add repository with SublimeMaven plugin. To do this, press Shift+Ctrl+P, select Package Control: Add Repository. Type in https://github.com/nlloyd/SublimeMaven and press Enter.

Press Shift+Ctrl+P again and select Package Control: Install Package. Search for SublimeMaven and press Enter.

It should be installed now. Now go to Tools>Build System and select Maven.

Sublime Text Xml Formatter

Now open folder with you project (having pom.xml in it), press Ctrl+B. Type in your desired Maven parameter, press Enter and you're good to go!