...

Text file src/github.com/protocolbuffers/txtpbfmt/docs/config.md

Documentation: github.com/protocolbuffers/txtpbfmt/docs

     1# Text Proto Formatter - Configuration
     2
     3<!--* freshness: { exempt: true } *-->
     4
     5`txtpbfmt` provides several configuration options that customize the specifics
     6of the output format. These are configured by adding a comment line to top of
     7the proto file (before the first non-empty non-comment line) of the form:
     8
     9`# txtpbfmt: [config-option]`
    10
    11This doc describes each of these options.
    12
    13## AllowTripleQuotedStrings
    14`# txtpbfmt: allow_triple_quoted_strings`
    15
    16Permit usage of Python-style `"""` or `'''` delimited strings.
    17
    18## AllowUnnamedNodesEverywhere
    19`# txtpbfmt: allow_unnamed_nodes_everywhere`
    20
    21Allow unnamed nodes everywhere.
    22Default is to allow only top-level nodes to be unnamed.
    23
    24## ExpandAllChildren
    25`# txtpbfmt: expand_all_children`
    26
    27Expand all children irrespective of the initial state.
    28
    29### Before formatting
    30
    31[Example](examples/expand_all_children.IN.textproto)
    32
    33### After formatting
    34
    35[Example](examples/expand_all_children.OUT.textproto)
    36
    37## PreserveAngleBrackets
    38
    39`# txtpbfmt: preserve_angle_brackets`
    40
    41Whether angle brackets used instead of curly braces should be preserved
    42when outputting a formatted textproto.
    43
    44### Before formatting
    45
    46[Example](examples/preserve_angle_brackets.IN.textproto)
    47
    48### After formatting
    49
    50[Example](examples/preserve_angle_brackets.OUT.textproto)
    51
    52## RemoveDuplicateValuesForRepeatedFields
    53`# txtpbfmt: remove_duplicate_values_for_repeated_fields`
    54
    55Remove lines that have the same field name and scalar value as another.
    56
    57### Before formatting
    58
    59[Example](examples/remove_duplicate_values_for_repeated_fields.IN.textproto)
    60
    61### After formatting
    62
    63[Example](examples/remove_duplicate_values_for_repeated_fields.OUT.textproto)
    64
    65## SkipAllColons
    66`# txtpbfmt: skip_all_colons`
    67
    68Skip colons whenever possible.
    69
    70### Before formatting
    71
    72[Example](examples/skip_all_colons.IN.textproto)
    73
    74### After formatting
    75
    76[Example](examples/skip_all_colons.OUT.textproto)
    77
    78## SmartQuotes
    79
    80`# txtpbfmt: smartquotes`
    81
    82Use single quotes around strings that contain double but not single quotes.
    83
    84### Before formatting
    85
    86[Example](examples/smartquotes.IN.textproto)
    87
    88### After formatting
    89
    90[Example](examples/smartquotes.OUT.textproto)
    91
    92## SortFieldsByFieldName
    93`# txtpbfmt: sort_fields_by_field_name`
    94
    95Sort fields by field name.
    96
    97### Before formatting
    98
    99[Example](examples/sort_fields_by_field_name.IN.textproto)
   100
   101### After formatting
   102
   103[Example](examples/sort_fields_by_field_name.OUT.textproto)
   104
   105## SortRepeatedFieldsByContent
   106`# txtpbfmt: sort_repeated_fields_by_content`
   107
   108Sort adjacent scalar fields of the same field name by their contents.
   109
   110### Before formatting
   111
   112[Example](examples/sort_repeated_fields_by_content.IN.textproto)
   113
   114### After formatting
   115
   116[Example](examples/sort_repeated_fields_by_content.OUT.textproto)
   117
   118## SortRepeatedFieldsBySubfield
   119`# txtpbfmt: sort_repeated_fields_by_subfield=[subfieldSpec]`
   120
   121Sort adjacent message fields of the given field name by the contents of the given subfield.
   122`subfieldSpec` is of one of two forms
   123
   124* `fieldName.subfieldName`, which will sort fields named `fieldName` by the value of their subfield named `subfieldName`.
   125* `subfieldName`, which will sort any field by its subfield named `subfieldName`
   126
   127### Before formatting
   128
   129[Example](examples/sort_repeated_fields_by_subfield.IN.textproto)
   130
   131### After formatting
   132
   133[Example](examples/sort_repeated_fields_by_subfield.OUT.textproto)
   134
   135## WrapHTMLStrings
   136`# txtpbfmt: wrap_html_strings`
   137
   138Whether strings that appear to contain HTML tags should be wrapped
   139(requires WrapStringsAtColumn to be set).
   140
   141### Before formatting
   142
   143[Example](examples/wrap_html_strings.IN.textproto)
   144
   145### After formatting
   146
   147[Example](examples/wrap_html_strings.OUT.textproto)
   148
   149## WrapStringsAtColumn
   150`# txtpbfmt: wrap_strings_at_column=[column]`
   151
   152Max columns for string field values. If zero, no string wrapping will occur.
   153Strings that may contain HTML tags will not be wrapped unless
   154`wrap_html_strings` is also specified.
   155
   156### Before formatting
   157
   158[Example](examples/wrap_strings_at_column.IN.textproto)
   159
   160### After formatting
   161
   162[Example](examples/wrap_strings_at_column.OUT.textproto)

View as plain text