šŸ’¾ Archived View for thatit.be ā€ŗ 2023-11-01-05-50-34.gmi captured on 2024-05-10 at 11:06:11. Gemini links have been rewritten to link to archived content

View Raw

More Information

ā¬…ļø Previous capture (2024-03-21)

āž”ļø Next capture (2024-05-26)

šŸš§ View Differences

-=-=-=-=-=-=-

more toying with rg and pandoc

Along the same lines as previous tinkering, I was thinking about how the YAML block at the beginning of each note really helps set it apart so that itā€™s obvious each note is coming from a different file. It seemed logical that Pandoc could preserve that if I found the right switches, and it turns out it can.

The switch is just to enable yaml_metadata_block in the output type.

For example, all notes mentioning Pandoc:

    rg -l 'pandoc' notes | \
    parallel pandoc --template=resources/template.markdown \
   --shift-heading-level-by=1 -t markdown+yaml_metadata_block \
   --reference-links --reference-location=document {} \; echo \
   | bat -t md

The only problem is that I canā€™t see the file name of the note something came from, so I canā€™t edit one of the files I see by name. Not too big of a deal, as I can use nvim $(rg -l 'some phrase' notes) and open the file based on content.

I can almost use this same logic on the entire set of my notes to fix formatting, links, and table styles so that everything is well in Obsidian, too.

Hereā€™s a little preview:

    rg -l 'pandoc' notes | parallel pandoc --template=resources/template.markdown \
    --shift-heading-level-by=1 \
    -t markdown+yaml_metadata_block+pipe_tables-simple_tables \
    --reference-links --reference-location=document {} \; echo | bat -t md

And hereā€™s what that looks like:

asciinema captureasciinema capture

This would replace all the tables with the only format Obsidian supports (not that Iā€™m bitter) make all the links into reference links for better Gemini formatting, and preserve the YAML meta data that I use internally.

The only issue is that the template I reference above is the one that formats my Gemini posts. The issue here is that it puts the note title at the top of the note in heading 1, hence the --shift-heading-level-by=1 to demote all the remaining headers down a level.

Iā€™ll need to make a new template and not do the heading shifts. Iā€™ll try this out a bit over the next few days and if it produces decent output Iā€™ll convert and review everything. Then Iā€™ll probably make a macro for calling Pandoc from within my editor so I can maintain consistent formatting going forward.

previous tinkering

Tags

#rg

#pandoc

Navigation

index

tags

updated: 2023-11-05 17:25:29

generated: 2024-05-03