Importing bash sessions

Hi all,

I’m very new to Obsidian, and also somewhat new to Markdown (not completely new though). I would like to transform bash (terminal) session logs as single files into Obsidian and use e.g. a Python script to do the transformation into a markdown file. The main issue here is that bash sessions are like code fragments, they should be displayed in a fixed width font and avoid escaping. However, if I use the triple-backticks, I can’t include links into the code, and this is a feature I would like to keep. The translation script will heuristically detect certain elements and create links ([[..]]) around them, but of course these won’t be interpreted inside triple-backtick-blocks. It is however possible to embed them into single-backtick-stuff by leaving this mode shortly. Here is a sample that already looks pretty ok:

# Some title
##### `$ some bash command`
`output with a detected `[[reference]]` and some stuff behind`
``line with a single ` ``
`line with a double `` `
`   line with leading spaces`
`___workaround with underscores`
---
##### `$ some `[[reference]]` command`
`other output`

It even allows to use folding and rules to separate the commands, which is nice, and embedding backticks is also possible by modifying the delimiters. However, single-backticks ignore leading and trailing spaces, and it would be nice to have a way to keep these, mainly leading ones. I also looked for some way to insert horizontal spaces outside the backtick part on a line, but did not find anything. Is there a way to do this?

thanks in advance,

klaymen

PS: I also tried using different unicode space replacements, as seen on Unicode spaces, but they all get ignored in preview mode, even U+1680. The best I can do is using a normal space and then use something like U+2420 from the second space on (visible space).

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.