Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harmonize .tsv examples (and their rendering) #644

Open
yarikoptic opened this issue Oct 8, 2020 · 1 comment · May be fixed by #1783
Open

Harmonize .tsv examples (and their rendering) #644

yarikoptic opened this issue Oct 8, 2020 · 1 comment · May be fixed by #1783
Labels
enhancement New feature or request formatting Aesthetics and formatting of the spec

Comments

@yarikoptic
Copy link
Collaborator

Inspired by discussion in #619 I came to realization that there is no consistency ATM: .tsv "Text" examples come both in

proper TSV form
$> git grep -e '        ' | grep '\.md'
src/02-common-principles.md:onset	duration	response_time	correct	stop_trial	go_trial
src/02-common-principles.md:200	200	0	n/a	n/a	n/a
src/03-modality-agnostic-files.md:filename	acq_time
src/03-modality-agnostic-files.md:func/sub-control01_task-nback_bold.nii.gz	1877-06-15T13:45:30
src/03-modality-agnostic-files.md:func/sub-control01_task-motor_bold.nii.gz	1877-06-15T13:55:33
src/04-modality-specific-files/08-genetic-descriptor.md:participant_id	age	sex	group	genetic_id	idh_mutation
src/04-modality-specific-files/08-genetic-descriptor.md:sub-control01	34	M	control	124587	yes
src/04-modality-specific-files/08-genetic-descriptor.md:sub-control02	12	F	control	548936	yes
src/04-modality-specific-files/08-genetic-descriptor.md:sub-patient01	33	F	patient	489634	no
src/05-derivatives/03-imaging.md:	    anat/
src/05-derivatives/03-imaging.md:		    sub-001_space-orig_probseg.nii.gz
src/05-derivatives/03-imaging.md:		    sub-001_space-orig_probseg.json
and more often in some shape of "replace tab with some spaces" - some times with nice layout into a tabular form, some times not really (even canonical example had no tabs but varying number of spaces used for delimiting, #643 ). IMHO ideally
  • markdown sources should use TABs where TABs are intended to be used
  • rendering into HTML or PDF should do its best to signal that they are tabs while providing visually coherent display of the table.

I.e. ideally it should be a job of remake (some plugin) to do use TABS (ATM they are replaced by spaces by remake I guess), and just use HTML/CSS to provide nice visual alignment into the table (should be possible) while having TAB as the actual character so content could be copy pasted. Even though it is unlikely the actual entries would be copy pasted, I would expect some readers copy-paste headers (which also should be tab-delimited). Could even use (although not really needed and overkill) smth like https://www.datatables.net/, where copy pasting a row from that fancy table does produce tab delimited entries:

$> xsel -o | sed -e 's, ,·,g' -e 's,\t,⇰,g'

Name⇰Position⇰Office⇰Age⇰%      
@sappelhoff
Copy link
Member

sappelhoff commented Oct 26, 2023

IMHO something like this would be nice:

👇 this is what you could find in the source of the spec (md)

<!--
This block generates a table.
<insert some more docs>
-->
{{ MACROS___plot_tsv_example(
"""
header1	header2	header3
val11	val12	val13
val21	val22	val23
"""
)
}}

Which would then be turned to a standard table in html and pdf:

header1 header2 header3
val11 val12 val13
val21 val22 val23

that way we'd have the example nicely in source tsv (in the raw MD file) ... and in nice html/pdf tables for the part that people actually read.

Now the cherry on top for me would be if there was some html/css magic (for web version only) that if hovering over the table, there'd be a "copy button" that would copy the tsv source (not the rendered table).

But that would not be necessary as a first step IMHO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request formatting Aesthetics and formatting of the spec
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants