Copy as HTML not retaining Italics or Bold

I use Scrivener to hold my fanfiction, and I would like to post to Ao3 directly from scrivener. The website has support for plain text with limited html, so I thought that using the simply ‘copy as html’ option would work for my needs, or even the ‘copy as basic html’ since I don’t need to worry about retaining heading formats or anything, just indents, paragraph breaks, italics, bold, and occasional extra line breaks.
But Neither ‘copy as html’ nor ‘copy as basic html’ retain italics or bold when I paste it into the editor on the website. When I read through the html, the italic tags aren’t even there anymore?
I understand that these things would be retained if I exported the file as an .rtf but Ao3 as a webpage doesn’t allow me to then Import an .rtf file. You have to put the text directly into the editor on the website. So if I exported as an .rtf I’d then have to re-open it somewhere and RE-copy it to try to paste which is a lot of steps for what should be a very simple copy/paste.
Why doesn’t the ‘copy as html’ actually copy all the html involved, and is there another option I can use to get the result I want without importing and exporting things?

I wonder if maybe the site doesn’t like how it is setting italics. At least it should be throwing a span around the italic text, with some CSS to make it italic. We should maybe make that a bit better and use <em> or even <i> as that is more broadly compatible. Are you not seeing the spans though? Maybe there is an issue with how it is set as italic in the editor. Is there anything unusual you’re doing, like using styles instead? That should work equally well, but I’m trying to think of why they simply wouldn’t be recognised at all.

Well, one thing I often recommend to people who need cleaner HTML for pasting into websites is to compile to MultiMarkdown (HTML), at the very bottom of the Compile For menu. The trick is to go into the Options tab on the right, and set the Convert rich text to MultiMarkdown checkbox. Otherwise it would only work if you actually wrote using Markdown (asterisks instead of italics). If you just want one piece of the outline, back in the Contents tab, set the compile group at the top to “Current Selection”, which will use whatever you select in the binder before going into compile.

That’s going to be much cleaner than anything you’ll get out of rich text to HTML conversion in Scrivener.

1 Like

Hrm, okay I do see the spans, but I admit I was looking for em or i as that’s what I’m more familiar with. For some reason the website isn’t registering the span style=italics as actually Being an italicization?
I’m a little confused about the compiling option, as wouldn’t that mean creating a new file on my computer for the text, which would then need to be imported to the webpage?

I’ve been searching thoroughly through reddit and fanfiction writing sites to see what other fanfic writers do about the problem, but they all seem to go through a third party to post anything, exporting the file into a totally different writing program just so they can copy and paste it, which while I understand it technically Works, it does kind of defeat the purpose of having scrivener if I have to go through a different writing program anyway? I think the only one that didn’t require also owning word or going through google docs (the program i’m trying to move Away from) was suggesting exporting to an html file and then opening the file in Notepad, then copy/pasting into the editor. Which DID retain the italics and is working as a quick fix for the moment.
I’m just confused why exporting as html keeps italics but Copying as html doesn’t?

If you’re using a non-chromium browser like Firefox, you could try enabling HTML on Scrivener’s clipboard and then using a regular copy and paste into the rich-text editor on Ao3. Open File > Options, select Sharing, then Export and tick the option to Write HTML clipboard data. Set the Styling dropdown above it to “Inline CSS”.

2 Likes

!!! That did it! I still have weird spaces between my non italic punctuation and my italic words but that’s apparently an ao3 thing, so its neither here nor there.

This option allowed me to copy and paste my text directly into the rich text editor and it retained all the italics and bolding! Thank you so much for your patience and help! This completely eliminates my need to use a third-party system to move my fic to ao3, which is a gamechanger! :heart:

I love Firefox. XD

I will now share this trick with every fic writer i come across who uses scrivener and firefox. :heart:

2 Likes

I have exactly this same needs, and the ticked option did not work for me:

Upon inspection after Ctrl-C, the content of the clipboard has a new type, the text/html, but its content is empty (whereas the text/plain and text/rtf are populated with the relevant content as before).

Did you use just Ctrl-C or the special “copy as html” menu? (the latter is still in text/plain for me, despite the option)

This behavior was a surprise for me too.
I need to paste HTML for the conversion, not plain text made of html markup.
I understand the workaround, to paste it in a tool understanding html and then copy another time from the latter.
But it would be very easy to have both clipboards, the plain text (made of html) as it is now, and the html type too (same content), so that it get the right behavior when pasting in html capable tools, and the same behavior as now for text only tools.
Everyone would be happy, and it’s an easy code to adjust.

There’s a setting for this you can enable in File ▸ Options. Select Sharing, then the Export tab and tick “Write HTML clipboard data”; I’d also switch the Styling dropdown to “Inline CSS”.

This will allow some basic formatting like bold and italic to be preserved when pasting into certain environments. Chrome unfortunately probably won’t take it, but it can fix the issue of not retaining formatting when pasting into other browsers, like Firefox, and for those who’ve had trouble pasting into MS Word.

2 Likes

I checked that option (thank you for the tip!) but all it does is to add a text/html type in the clipboard… with an empty string as data!!! :pleading_face:

What I did:

  • activate the option (apply, save), and it does have an effect as said above
  • I tried all css options
  • If I copy with Ctrl-C : empty string in text/html clipboard
  • If I copy with special copy for html: no change at all, still the html in text/plain only …

So… it fails. What did I do wrong?

Maybe it would help to better understand what you’re doing, where you’re copying from and how you’re checking the clipboard contents. As an example:

  1. In File Explorer, navigate into Scrivener’s installation folder and double-click the clipboard.exe to open a clipboard capture
  2. In a blank document in Scrivener’s editor, type “Example italic and bold text”
  3. Apply italic and bold character formatting to “italic” and “bold” respectively
  4. Ctrl-A to select all the text, Ctrl+C to copy

In the clipboard capture window, you should see a text/html format on the left, which if selected should show you the “Example italic and bold text” displayed with formatting in the “Rich” field at the top right and as an HTML fragment in the “Plain” field in the centre right—this is plain-text for your viewing, but pasted into an environment that accepts the HTML off the clipboard, the pasted text will appear as in the rich text preview at the top.

  • If I copy with special copy for html: no change at all, still the html in text/plain only …

To be clear, the Copy as HTML is not a way of putting HTML data on the clipboard but rather has always been a means to convert the rich text copied from Scrivener into HTML syntax that can be pasted as such. I don’t think that’s what you’re after, if I’m understanding the request. To which end, I’ve shifted this discussion over to a more appropriate thread. :slight_smile:

2 Likes

Thanks a lot for your time helping me on this, much appreciated! (having a decent workflow is so important)

What I was doing:

  1. Create a simple text in Scrivener:

The text from Scrivener.
More text with some italics and some bold in it too.
Other text.

  1. Copy this whole text, or even some of my novel text with italics in it: Ctrl-C
  2. In the online Clipboard Inspector I type Ctrl-V to paste.
  3. Although I rarely had any issues with this online tool, for some reason it fails to see the html data (“empty string”) whereas the tool you point me to (clipboard.exe) see the html that Scrivener has copied.

Now that I know there’s really html in the clipboard, I investigated more:

  1. With the CSS option (any of the two):
  • Pasting it into Remarkable desktop app: the whole text is bold, and the italic is where it should be (although bold too).
  • Pasting it into Google Doc: no formatting at all!

I think there’s a bug in Scrivener because the rich view of the clipboard.exe for the html content also shows all bold, exactly the same as what I get in Remarkable.

  1. With the “no CSS” option:
  • Now ok in Remarkable :hugs: (which is my target), as it is also rendered well in the inspector.
  • Still no formatting in Google Doc

So, I’ll stick with that option, this solves the Scrivener to Remarkable 2 transfer.

Thanks again for your help! :folded_hands: