Hello. I’m writing a web serial which requires me to copy-paste my work to internet platforms like Royal Road on a regular basis. Since Markdown is not supported on these platforms, I have to copy-paste from Reading View to copy the italics and bold formatting properly.
What I’m trying to do
My problem is that my section break identifiers don’t copy over. So far, I’ve been using three hashmarks ### to identify a break between sections, which occurs frequently as I have a large cast of characters. But in Reading View, the hashmarks just format as a doublespace.
I’ve been hopping back and forth between Obsidian and Scrivener for some time now. If I can solve my copy-paste needs in a simple one-step way, that might be the last thing I need to move over to Obsidian permanently. Any ideas how I can edit Reading View to display ### properly?
Things I have tried
I have not tried anything to solve this yet as I lack the coding knowledge to do so. However, I can often figure out how to implement coding fixes when they’re explained to me. (I came to Obsidian from my own markdown note-taking system using Neovim.)
Does escaping the hashtags (by using a backslash at the start of the relevant lines) give you the result you need?
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
\###
Eget sit amet tellus cras adipiscing enim eu. Sit amet aliquam id diam maecenas ultricies mi.
Hi, thanks! This does work for the problem of copy-pasting from reading view.
However, this only seems like a temporary fix to me. At the end of a book, I also need to be able to export the whole story via Pandoc, which will include the backslashes. Of course, can always fix it via find/replace, but if there is a short line of code I could add to a config file to treat ### like plain text in reading view, that would be the ideal solution for my needs.
If I’m understanding correctly, the goal is to use empty/blank h3 headings (### ) in the editor, but have them displayed and be copyable in Reading view, is that right? You could try this:
### \#\#\#
and then some CSS to style them a bit in Reading view (if desired):
Another option is to continue using ### only and use CSS to display “fake” headers in Reading view, but these won’t be copyable or show up in exports, etc.
This does look nicer in Obsidian, so if I go this route I’ll probably do the CSS, thanks.
This sounds intriguing! When you say the “fake” headers won’t be copyable, do you mean that they would be viewable in Reading View, but CTRL-C won’t copy the text to the clipboard? If so, then it wouldn’t work.
It’d have the same effect as escaping the ### header, I suppose, which comes with the same limitations.
But on second thought, now I wonder if there might be a custom pandoc tag that could remove the odd formatting when I export at the end. Like perhaps a tag that removes all backslashes or instances of < div >. I’m not sure if this is the right forum to ask for that, but it could be a much easier way to deal with this, easier than find/replace even.
Actually wait a minute—I think I was confused. Pandoc .md to .docx will translate all markdown formatting to standard .docx formatting, which means that it should just output the same thing as what we see on Reading View, correct? ie. /### will output as ### in the Pandoc-converted document.
If this is correct, then thank you! You solved my problem!
I was originally thinking they wouldn’t be copyable, but this works.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
###
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
###
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
and the example CSS below. The “fake” part is whatever is in the content:''; section. It can be most anything you’d like. I’m a fan of content: ':::' You can play around with the other values and adjust as necessary.
For the custom CSS, would I have to add this to every document I want it to apply to? Or is there a config file where I could add it once and forget about it? Ideally, I’d like it to apply to all the files in my Manuscript folder.
I am afraid I don’t know the answer to that. I have no experience of Pandoc or Word, but if Pandoc translates all .md formatting to standard .docx formatting, it sounds as though it might work. Hope so. Assume it is relatively straightforward to run a small proof-of-concept test. Good luck.
All CSS is put into a .css file (or multiple files) as snippets. The CSS itself doesn’t go into notes (thankfully). Details and setup here → CSS snippets - Obsidian Help
I see two options to narrow the scope (instead of the snippet applying to all notes). Use a modified version with a class attached (like above):
and put cssclasses: h3-faint in the notes you want to style. If it’s only a few notes, this seems the easiest.
Luckily someone had the great idea of applying CSS to all notes based on path. Here’s where the GitHub - nathonius/obsidian-auto-class: Automatically add CSS classes to notes based on file path. plugin comes in. Using the snippet just above with the class attached, set a path and this class in AutoClass. Close-open or reload the vault. All notes in the Manuscript folder will get this snippet applied to them.