Skip to content

Commit 02509bd

Browse files
mortenpiNHDaly
authored andcommitted
doc: correct unicode-input table generation (#51328)
A couple small fixes and cosmetic improvements to the Unicode table in the docs: * Most importantly, makes sure that the resulting object from the at-eval block is `Markdown.MD`, which which will be necessary for Documenter 1.0 (#47105). It also fixes the `Markdown.Table` structure -- each of the cells should be an array, not just a string, so it adds one more layer of nesting. * Cosmetically, center-aligns the characters, and wraps the latex commands in `<code>`
1 parent 7d1187d commit 02509bd

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

doc/src/manual/unicode-input.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,12 @@ function fix_combining_chars(char)
5252
return cat == 6 || cat == 8 ? "$NBSP$char$NBSP" : "$char"
5353
end
5454
55-
5655
function table_entries(completions, unicode_dict)
57-
entries = [[
58-
"Code point(s)", "Character(s)",
59-
"Tab completion sequence(s)", "Unicode name(s)"
56+
entries = Any[Any[
57+
["Code point(s)"],
58+
["Character(s)"],
59+
["Tab completion sequence(s)"],
60+
["Unicode name(s)"],
6061
]]
6162
for (chars, inputs) in sort!(collect(completions), by = first)
6263
code_points, unicode_names, characters = String[], String[], String[]
@@ -65,12 +66,21 @@ function table_entries(completions, unicode_dict)
6566
push!(unicode_names, get(unicode_dict, UInt32(char), "(No Unicode name)"))
6667
push!(characters, isempty(characters) ? fix_combining_chars(char) : "$char")
6768
end
69+
inputs_md = []
70+
for (i, input) in enumerate(inputs)
71+
i > 1 && push!(inputs_md, ", ")
72+
push!(inputs_md, Markdown.Code("", input))
73+
end
6874
push!(entries, [
69-
join(code_points, " + "), join(characters),
70-
join(inputs, ", "), join(unicode_names, " + ")
75+
[join(code_points, " + ")],
76+
[join(characters)],
77+
inputs_md,
78+
[join(unicode_names, " + ")],
7179
])
7280
end
73-
return Markdown.Table(entries, [:l, :l, :l, :l])
81+
table = Markdown.Table(entries, [:l, :c, :l, :l])
82+
# We also need to wrap the Table in a Markdown.MD "document"
83+
return Markdown.MD([table])
7484
end
7585
7686
table_entries(

0 commit comments

Comments
 (0)