diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 80671a10d3..053b76431c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,6 +10,7 @@ repos: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml + args: [--unsafe] - id: check-json - id: check-toml - id: check-ast diff --git a/mkdocs.yml b/mkdocs.yml index d0738c7e29..ef36d6eb5c 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -104,7 +104,12 @@ extra_javascript: markdown_extensions: - toc: anchorlink: true - - pymdownx.superfences + - pymdownx.superfences: + preserve_tabs: true + custom_fences: + - name: tsv + class: tsv + format: !!python/name:bidsschematools.render.tsv.fence - admonition - pymdownx.details plugins: diff --git a/pdf_build_src/pandoc_script.py b/pdf_build_src/pandoc_script.py index e9710482ab..b425fbeb50 100644 --- a/pdf_build_src/pandoc_script.py +++ b/pdf_build_src/pandoc_script.py @@ -39,7 +39,7 @@ def _flatten_values(lst): fname_mkdocs_yml = _find(HERE, "mkdocs.yml") with open(fname_mkdocs_yml, "r") as stream: - mkdocs_yml = yaml.safe_load(stream) + mkdocs_yml = yaml.load(stream, yaml.Loader) sections = mkdocs_yml["nav"][0]["The BIDS Specification"] diff --git a/src/appendices/arterial-spin-labeling.md b/src/appendices/arterial-spin-labeling.md index 842bde8d80..ce182ca0d9 100644 --- a/src/appendices/arterial-spin-labeling.md +++ b/src/appendices/arterial-spin-labeling.md @@ -26,7 +26,7 @@ and the exact volume_type series should be specified in the `*_aslcontext.tsv`. Example of `*_aslcontext.tsv`: -```Text +```tsv volume_type control label @@ -44,7 +44,7 @@ In this case, the `deltam` should be included in the `*_asl.nii[.gz]` and specif Example of `*_aslcontext.tsv`: -```Text +```tsv volume_type deltam m0scan @@ -58,7 +58,7 @@ the `cbf` should be included in the `*_asl.nii[.gz]` and specified in the `*_asl Example of `*_aslcontext.tsv`: -```Text +```tsv volume_type cbf m0scan diff --git a/src/appendices/hed.md b/src/appendices/hed.md index 4582356ee5..830c132120 100644 --- a/src/appendices/hed.md +++ b/src/appendices/hed.md @@ -44,10 +44,10 @@ meanings in associated JSON sidecar files (`events.json`). (`trial_type`, `response_time`, and `stim_file`) in addition to the required `onset` and `duration` columns. -```Text -onset duration trial_type response_time stim_file -1.2 0.6 go 1.435 images/red_square.jpg -5.6 0.6 stop n/a images/blue_square.jpg +```tsv +onset duration trial_type response_time stim_file +1.2 0.6 go 1.435 images/red_square.jpg +5.6 0.6 stop n/a images/blue_square.jpg ``` The `trial_type` column in the above example contains a limited number of distinct diff --git a/src/derivatives/common-data-types.md b/src/derivatives/common-data-types.md index 63f0809c55..084fca8eb4 100644 --- a/src/derivatives/common-data-types.md +++ b/src/derivatives/common-data-types.md @@ -328,11 +328,12 @@ A guide for using macros can be found at Contents of the `descriptions.tsv` file: -| desc_id | description | -| ------- | ----------------------------------------------------------------------------------------------- | -| Filt | low-pass filtered at 30Hz | -| FiltDs | low-pass filtered at 30Hz, downsampled to 250Hz | -| preproc | low-pass filtered at 30Hz, downsampled to 250Hz, and rereferenced to a common average reference | +```tsv +desc_id description +Filt low-pass filtered at 30Hz +FiltDs low-pass filtered at 30Hz, downsampled to 250Hz +preproc low-pass filtered at 30Hz, downsampled to 250Hz, and rereferenced to a common average reference +``` diff --git a/src/longitudinal-and-multi-site-studies.md b/src/longitudinal-and-multi-site-studies.md index b64ae016e8..48960366ef 100644 --- a/src/longitudinal-and-multi-site-studies.md +++ b/src/longitudinal-and-multi-site-studies.md @@ -65,7 +65,7 @@ A guide for using macros can be found at `sub-control01_sessions.tsv` content: -```Text +```tsv session_id acq_time systolic_blood_pressure ses-predrug 2009-06-15T13:45:30 120 ses-postdrug 2009-06-16T13:45:30 100 diff --git a/src/modality-agnostic-files.md b/src/modality-agnostic-files.md index b93ee17638..b88c264856 100644 --- a/src/modality-agnostic-files.md +++ b/src/modality-agnostic-files.md @@ -246,11 +246,11 @@ available"). `participants.tsv` example: -```Text -participant_id age sex handedness group -sub-01 34 M right read -sub-02 12 F right write -sub-03 33 F n/a read +```tsv +participant_id age sex handedness group +sub-01 34 M right read +sub-02 12 F right write +sub-03 33 F n/a read ``` It is RECOMMENDED to accompany each `participants.tsv` file with a sidecar @@ -320,13 +320,13 @@ and a guide for using macros can be found at `samples.tsv` example: -```Text -sample_id participant_id sample_type derived_from -sample-01 sub-01 tissue n/a -sample-02 sub-01 tissue sample-01 -sample-03 sub-01 tissue sample-01 -sample-04 sub-02 tissue n/a -sample-05 sub-02 tissue n/a +```tsv +sample_id participant_id sample_type derived_from +sample-01 sub-01 tissue n/a +sample-02 sub-01 tissue sample-01 +sample-03 sub-01 tissue sample-01 +sample-04 sub-02 tissue n/a +sample-05 sub-02 tissue n/a ``` It is RECOMMENDED to accompany each `samples.tsv` file with a sidecar @@ -486,7 +486,7 @@ All such included additional fields SHOULD be documented in an accompanying Example `_scans.tsv`: -```Text +```tsv filename acq_time func/sub-control01_task-nback_bold.nii.gz 1877-06-15T13:45:30 func/sub-control01_task-motor_bold.nii.gz 1877-06-15T13:55:33 @@ -522,7 +522,7 @@ and a guide for using macros can be found at `_sessions.tsv` example: -```Text +```tsv session_id acq_time systolic_blood_pressure ses-predrug 2009-06-15T13:45:30 120 ses-postdrug 2009-06-16T13:45:30 100 diff --git a/src/modality-specific-files/behavioral-experiments.md b/src/modality-specific-files/behavioral-experiments.md index c059383d0e..cfb8264ce3 100644 --- a/src/modality-specific-files/behavioral-experiments.md +++ b/src/modality-specific-files/behavioral-experiments.md @@ -78,7 +78,7 @@ A guide for using macros can be found at ## Example `_beh.tsv` -```Text +```tsv trial response response_time stim_file congruent red 1.435 images/word-red_color-red.jpg incongruent red 1.739 images/word-red_color-blue.jpg diff --git a/src/modality-specific-files/electroencephalography.md b/src/modality-specific-files/electroencephalography.md index fb15cb7710..cb765c9549 100644 --- a/src/modality-specific-files/electroencephalography.md +++ b/src/modality-specific-files/electroencephalography.md @@ -274,12 +274,12 @@ Examples of free-form text for field `description` See also the corresponding [`electrodes.tsv` example](#example-_electrodestsv). -```Text -name type units description reference status status_description -VEOG VEOG uV left eye VEOG-, VEOG+ good n/a -FDI EMG uV left first dorsal interosseous FDI-, FDI+ good n/a -Cz EEG uV n/a REF bad high frequency noise -UADC001 MISC n/a envelope of audio signal n/a good n/a +```tsv +name type units description reference status status_description +VEOG VEOG uV left eye VEOG-, VEOG+ good n/a +FDI EMG uV left first dorsal interosseous FDI-, FDI+ good n/a +Cz EEG uV n/a REF bad high frequency noise +UADC001 MISC n/a envelope of audio signal n/a good n/a ``` ## Electrodes description (`*_electrodes.tsv`) @@ -318,15 +318,15 @@ If electrodes are repositioned, it is RECOMMENDED to use multiple sessions to in See also the corresponding [`channels.tsv` example](#example-_channelstsv). -```Text -name x y z type material -VEOG+ n/a n/a n/a cup Ag/AgCl -VEOG- n/a n/a n/a cup Ag/AgCl -FDI+ n/a n/a n/a cup Ag/AgCl -FDI- n/a n/a n/a cup Ag/AgCl -GND -0.0707 0.0000 -0.0707 clip-on Ag/AgCl -Cz 0.0000 0.0714 0.0699 cup Ag/AgCl -REF -0.0742 -0.0200 -0.0100 cup Ag/AgCl +```tsv +name x y z type material +VEOG+ n/a n/a n/a cup Ag/AgCl +VEOG- n/a n/a n/a cup Ag/AgCl +FDI+ n/a n/a n/a cup Ag/AgCl +FDI- n/a n/a n/a cup Ag/AgCl +GND -0.0707 0.0000 -0.0707 clip-on Ag/AgCl +Cz 0.0000 0.0714 0.0699 cup Ag/AgCl +REF -0.0742 -0.0200 -0.0100 cup Ag/AgCl ``` The [`acq-