Skip to content

Commit cb521ff

Browse files
authored
Fix docs format (#16)
1 parent 320d2e6 commit cb521ff

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/json.erl

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -547,16 +547,16 @@ error_info(Skip) ->
547547
-type formatter() :: fun((Term :: term(), Encoder :: formatter(), State :: map()) -> iodata()).
548548
-endif.
549549

550-
%% @doc Generates formatted JSON corresponding to `Term`.
551-
%% Similiar to `encode/1` but with added whitespaces for formatting.
552-
%% ```erlang
550+
%% @doc Generates formatted JSON corresponding to `Term'.
551+
%% Similiar to `encode/1' but with added whitespaces for formatting.
552+
%% ```
553553
%% > io:put_chars(json:format(#{foo => <<"bar">>, baz => 52})).
554554
%% {
555555
%% "baz": 52,
556556
%% "foo": "bar"
557557
%% }
558558
%% ok
559-
%% ```
559+
%% '''
560560
-if(?OTP_RELEASE >= 26).
561561
-spec format(Term :: dynamic()) -> iodata().
562562
-else.
@@ -566,8 +566,8 @@ format(Term) ->
566566
Enc = fun format_value/3,
567567
format(Term, Enc, #{}).
568568

569-
%% @doc Generates formatted JSON corresponding to `Term`.
570-
%% Equivalent to `format(Term, fun json:format_value/3, Options)` or `format(Term, Encoder, #{})`
569+
%% @doc Generates formatted JSON corresponding to `Term'.
570+
%% Equivalent to `format(Term, fun json:format_value/3, Options)' or `format(Term, Encoder, #{})'
571571
-if(?OTP_RELEASE >= 26).
572572
-spec format(Term :: encode_value(), Opts :: map()) -> iodata();
573573
(Term :: dynamic(), Encoder::formatter()) -> iodata().
@@ -589,7 +589,7 @@ format(Term, Encoder) when is_function(Encoder, 3) ->
589589
%% when recursing through 'Term'.
590590
%% `format_value/3` or various `encode_*` functions in this module can be used
591591
%% to help in constructing such callbacks.
592-
%% ```erlang
592+
%% ```
593593
%% > formatter({posix_time, SysTimeSecs}, Encode, State) ->
594594
%% TimeStr = calendar:system_time_to_rfc3339(SysTimeSecs, [{offset, "Z"}]),
595595
%% json:format_value(unicode:characters_to_binary(TimeStr), Encode, State);
@@ -605,7 +605,7 @@ format(Term, Encoder) when is_function(Encoder, 3) ->
605605
%% "time": "2024-05-23T16:07:48Z"
606606
%% }
607607
%% ok
608-
%% ```
608+
%% '''
609609
-spec format(Term :: encode_value(), Encoder::formatter(), Options :: map()) -> iodata().
610610
format(Term, Encoder, Options) when is_function(Encoder, 3) ->
611611
Def = #{level => 0,
@@ -615,8 +615,8 @@ format(Term, Encoder, Options) when is_function(Encoder, 3) ->
615615
},
616616
[Encoder(Term, Encoder, maps:merge(Def, Options)),$\n].
617617

618-
%% @doc Default format function used by `json:format/1`.
619-
%% Recursively calls `Encode` on all the values in `Value`,
618+
%% @doc Default format function used by `json:format/1'.
619+
%% Recursively calls `Encode' on all the values in `Value',
620620
%% and indents objects and lists.
621621
-if(?OTP_RELEASE >= 26).
622622
-spec format_value(Value::dynamic(), Encode::formatter(), State::map()) -> iodata().
@@ -720,8 +720,10 @@ format_key_value_list(KVList, UserEnc, #{level := Level} = State) ->
720720
%% Accepts lists with atom, binary, integer, or float keys.
721721
%% Verifies that no duplicate keys will be produced in the
722722
%% resulting JSON object.
723-
%% ## Errors
724-
%% Raises `error({duplicate_key, Key})` if there are duplicates.
723+
%%
724+
%% Errors
725+
%%
726+
%% Raises `error({duplicate_key, Key})' if there are duplicates.
725727
-spec format_key_value_list_checked([{term(), term()}], Encoder::formatter(), State::map()) -> iodata().
726728
format_key_value_list_checked(KVList, UserEnc, State) when is_function(UserEnc, 3) ->
727729
{_,Indent} = indent(State),

0 commit comments

Comments
 (0)