Skip to content

Commit 9bc78e9

Browse files
committed
Headings in Markdown import
1 parent f32daaf commit 9bc78e9

File tree

5 files changed

+322
-18
lines changed

5 files changed

+322
-18
lines changed

README.md

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,14 +348,17 @@ Input files can be in one of six formats:
348348

349349
* A CSV file that is already in a format supported by iThoughts' Import function.
350350
* A flat file where each line is a new node. Spaces and tabs can be used to indent the text. Here the level of indentation is used to control what level the line is added at.
351-
* A Markdown nested list where each line is a new node. Spaces and tabs can be used to indent the text. Here the level of indentation is used to control what level the line is added at. Only an asterisk (`*`) followed by a space is supported as a list item marker.
351+
* A Markdown nested list where each line is a new node. Spaces and tabs can be used to indent the text. Here the level of indentation is used to control what level the line is added at. Either an asterisk (`*`) or a minus sign followed by a space are supported as a list item marker. \
352+
Further, Markdown headings of one type, described below, can be used.
352353
* An OPML XML file - with or without `head` or `body` elements.
353354
* An XML file, including one with namespaces (both default and named).
354355
* A CSV file where the hierarchy is described by how many empty cells are to the left of the first cell with text in.
355356

356357
#### Nesting Level Detection
357358

358-
When parsing a Markdown or tab/space-indented non-CSV file the first line with leading white space (spaces and/or tabs) is used to detect the indentation scheme: Any white space on this line is used as a single indentation level marker. It is expected that all lines are indented in the same way.
359+
When parsing a Markdown or tab/space-indented non-CSV file the first line with leading white space (spaces and/or tabs) is used to detect the indentation scheme: \
360+
Any white space on this line is used as a single indentation level marker. \
361+
It is expected that all lines are indented in the same way.
359362

360363
For example, if the second line starts with two spaces this is taken to indicate that every line will have zero, two, four, etc spaces:
361364

@@ -364,13 +367,52 @@ For example, if the second line starts with two spaces this is taken to indicate
364367
* Four spaces denotes a level 2 node
365368
* And so on
366369

367-
If the file is detected to contain Markdown, leading dashes and asterisks followed by a single space are removed. (These are bulleted list markers in Markdown.) For example:
370+
If the file is detected to contain Markdown, leading dashes and asterisks followed by a single space are removed. \
371+
(These are bulleted list markers in Markdown.) \
372+
For example:
368373

369374
* A
370375
* A1
371376

372377
leads to the input file being interpreted as a level 0 node with text "A" and its child node with text "A1".
373378

379+
You can also specify nesting levels using one of the two forms of heading that Markdown supports. \
380+
Consider the following example:
381+
382+
# Fruit
383+
384+
## Citrus
385+
386+
* Lemon
387+
* Orange
388+
* Vaguely orange-like
389+
* Mandarin
390+
* Satsuma
391+
392+
In this example:
393+
394+
* "Fruit" is a Heading Level 0 node.
395+
* "Citrus" is a Heading Level 1 node.
396+
* "Lemon", "Orange" and "Vaguely orange-like" are Heading Level 2 nodes.
397+
* "Mandarin" and "Satsuma" are Heading Level 3 nodes.
398+
* The blank lines in between are ignored.
399+
* The leading `#` and `*` characters are removed, as are the first space after each occurrence.
400+
401+
The resulting CSV file contains:
402+
403+
"dueDate","startDate","effort(hours)","priority","progress","icons","colour","note","position","shape","level","level0","level1","level2","level3"
404+
"","","","","","","","","","","0","Fruit"
405+
"","","","","","","","","","","1","","Citrus"
406+
"","","","","","","","","","","2","","","Lemon"
407+
"","","","","","","","","","","2","","","Orange"
408+
"","","","","","","","","","","2","","","Vaguely orange-like"
409+
"","","","","","","","","","","3","","","","Mandarin"
410+
"","","","","","","","","","","3","","","","Satsuma"
411+
412+
Imported into iThoughtsX, the resulting tree looks like:
413+
414+
![](images/importedMarkdown.png)
415+
374416
For an XML input file the nesting level is in the data stream; Elements' children are at a deeper nesting level. \
375417
On import child nodes are created for the element's value (if it has one) and any attributes. \
376418
These are colour coded and free-standing nodes marked "Element", "Value", and "Attribute" are added as a legend.
@@ -465,13 +507,25 @@ In the second case two levels of heading are required, starting with heading lev
465507

466508
You can export to HTML as either a nested list or a table. Colour is preserved on output, as are notes.
467509

510+
You can specify HTML nested list output by invocations such as
511+
512+
filterCSV html list < myfile.csv > myfile.md
513+
468514
You can specify HTML table output by invocations such as
469515

470516
filterCSV html table < myfile.csv > myfile.md
471517

472-
You can specify HTML nested list output by invocations such as
518+
The table will have extra columns if any of the nodes in the tree have any of the following attributes. \
519+
Each column has its own `class` attribute - which can be used for styling with CSS:
520+
521+
|Atribute|Class|
522+
|:-|:-|
523+
|Due Date|dueDate|
524+
|Start Date|startDate|
525+
|Effort|effort|
526+
|Priority|priority|
527+
|Progress|progress|
473528

474-
filterCSV html list < myfile.csv > myfile.md
475529

476530
#### Freemind And OPML XML Output
477531

0 commit comments

Comments
 (0)