Use case or problem
In most of the daily writing I do in my notes, I use tabs for formatting and emphasis. For example, I keep a list of poems in a common place book, and poetry often requires hard tabs to honor the poet’s construction. Right now, tabbing automatically parses to a code block
Provide an option in the editor settings to toggle whether tabs convert to code block.
Some kind forum members have suggested using CSS, but I think this is a change that should be made (if possible) at the parser level.
Sadly this would diverge from the markdown spec. If you never use code blocks, it is probably best to use CSS styling for code blocks as poetry.
Otherwise see e.g., Center text for selected notes (Poetry collection) [CSS].
Right. I’m thinking here though of an option (or maybe it could be a plugin?) in the editor to disable this for non-code writing. Something that would be handled I think in the parser.
Similar to Ulysses allowing different Markdown settings
Or how Brett Terpstra has built in a similar preference for Marked 2
Just to clarify: I’m not really looking for an option to style the output of poetry (I’ll do this through Marked), but rather a way to change the behavior of tabs in the editor, so that they do not default to a code block.
It seems to me, and I could be wrong, that many note takers and writers who do not primarily work with code would benefit from this as an option.
I have many notes with indents which should not default to code.
Also, if there’s an empty line in between, the indent will default to code, see screenshot below.
If anybody found a solution, please let me know.
@chrsle : In VSCode you can search and replace new lines while also using regex I think. I imagine you could do a mass search and replace using that tactic. In @akaalias documentation for pdf to markdown plugin he mentions using this
when trying to rid lines of an extra space at beginning of some lines in the converted text. I think between adapting that and possibly using the VSCode ability to include returns in searches, you could put something together. Perhaps you don’t need the regex at all, but I would think you would need some.
Bottom line, it seems possible.
Thanks so much for your thoughtful response, really appreciate it!
Unfortunately I don’t know how to code, so I won’t be able to implement your solution.
Much rather than editing my notes, I would love to be able to turn off code blocks alltogether, but I have no idea of CSS and how to do that.
Is there any existing CSS hack to turn off “indenting = code blocks”?
I don’t mind losing that markdown feature, as the is still the “````” way of doing it.
To be clear, you can’t disable the markdown feature, per se. You can edit how it appears so it doesn’t look like code anymore.
The exact CSS will depend on what the rest of your CSS is, however.
The “easiest” way is to open up your theme’s .css file, find the selector the theme uses to style paragraph text, and then add the code selector to that set of style instructions (I don’t know the selector offhand). Depending on how the CSS file is structured, however, this may not be straightforward.
Otherwise, you can custom-style this type of code. It looks like
cm-hmd-indented-code is the selector, so you’re looking to add a snippet for something like:
However, there’s a lot of assumptions baked into that snippet. It might work, it might not. You might want to look at some of the “getting started with CSS” stuff on the forum to be able to troubleshoot it!
Thanks a lot for your reply. Good to know and sad to hear that it can’t be turned off. I imagine changing the appearance while leaving elements as code blocks, may cause troubles down the road with linking, transcluding etc.
Guess I’ll just have to adjust my writing style.
Thanks again for the clarification!