Skip to content

Markdown preview renders monospace (code formatted) content wrong when tabs are involved #907

@RamRS

Description

@RamRS

Preview during edit/create seems to render monospace content wrong when tabs are involved. Here is an example post: https://www.biostars.org/p/490053/

This is probably owing to how tabs are handled - vep<TAB><SPACE> might take up the same white space as <TAB><SPACE> if the tab just jumps to end of word. But if every <TAB> were being translated to 4/8/whatever <SPACE>s, the text would render differently. I personally prefer spaces for this reason, but the point is, preview and real display should handle <TAB>s the same way. This inconsistency breaks display in these cases. Can something be done about this or is it up to the markdown engine creators?

Same content as the post but here:

With tabs:

vep 	 -i Mutect2_unfiltered_10643_vs_2434.vcf.gz
	 -o Mutect2_unfiltered_10643_vs_2434_VEP.ann.vcf
	 --assembly GRCh38
	 --species homo_sapiens
	 --offline  --cache  --cache_version 99
	 --dir_cache /.vep  --everything  --filter_common
	 --fork 4  --format vcf  --per_gene  --stats_file Mutect2_unfiltered_10643_vs_2434_VEP.summary.html
	 --total_length  --vcf

Here's what that looks like:

vep ^I -i Mutect2_unfiltered_10643_vs_2434.vcf.gz$
^I -o Mutect2_unfiltered_10643_vs_2434_VEP.ann.vcf$
^I --assembly GRCh38$
^I --species homo_sapiens$
^I --offline  --cache  --cache_version 99$
^I --dir_cache /.vep  --everything  --filter_common$
^I --fork 4  --format vcf  --per_gene  --stats_file Mutect2_unfiltered_10643_vs_2434_VEP.summary.html$
^I --total_length  --vcf$

Cleanup, tabs replaced with spaces:

vep  -i Mutect2_unfiltered_10643_vs_2434.vcf.gz
     -o Mutect2_unfiltered_10643_vs_2434_VEP.ann.vcf
     --assembly GRCh38
     --species homo_sapiens
     --offline  --cache  --cache_version 99
     --dir_cache /.vep  --everything  --filter_common
     --fork 4  --format vcf  --per_gene  --stats_file Mutect2_unfiltered_10643_vs_2434_VEP.summary.html
     --total_length  --vcf

Here's the cat -A of the above block:

vep  -i Mutect2_unfiltered_10643_vs_2434.vcf.gz$
     -o Mutect2_unfiltered_10643_vs_2434_VEP.ann.vcf$
     --assembly GRCh38$
     --species homo_sapiens$
     --offline  --cache  --cache_version 99$
     --dir_cache /.vep  --everything  --filter_common$
     --fork 4  --format vcf  --per_gene  --stats_file Mutect2_unfiltered_10643_vs_2434_VEP.summary.html$
     --total_length  --vcf$

As you can see, GitHub flavored markdown handled both beautifully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions