-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathConvertTo.Markdown.pq
More file actions
48 lines (40 loc) · 1.19 KB
/
ConvertTo.Markdown.pq
File metadata and controls
48 lines (40 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
let
SampleInput = GenerateDocs_OnType, // as table,
source = SampleInput,
Table_ToMarkdown = (source as table) as any => // text ?
let
headerRow = Format_RowsToMarkdown( Table.ColumnNames(source) ),
tableBody = generate_lines(source),
finalText = Text.Combine(
{headerRow, tableBody}, "#(cr,lf)")
in
finalText,
/*
Input: "foo", "bar"
Output: | foo | bar |
future:
tie into the better text coercion funcs
*/
Format_RowsToMarkdown = (row as record) as any => // text
let
values = Record.FieldValues(row),
joinPipe = Text.Combine(values, " | "),
finalString = Text.Combine({"|", joinPipe, "|"}, " ")
in
finalString,
/*
Input: "foo", "bar"
Output: | foo | bar |
future:
tie into the better text coercion funcs
*/
GenerateRows = (source as table) as list =>
let
generate_lines = Table.TransformRows(
source, Format_RowsToMarkdown
)
in
generate_lines,
test = Table_ToMarkdown( SampleInput )
in
test