Copy-And-Pasting Headers From ChatGPT -> formatting mess

Steps to reproduce

1. In ChatGPT, generate a Markdown heading (e.g. ## Heading).
2. Copy it to the clipboard on macOS.
3. In Obsidian, ensure Editor → Convert pasted HTML to Markdown is enabled.
4. Paste into a note.

Did you follow the troubleshooting guide? [Y/N]

Y

Environment

macOS Sequoia 15.6.1 (MacBook Air M-series)
Obsidian v1.9.12 (installer build 1.9.10)
Sandbox vault (no plugins, no CSS snippets, default theme)
Issue reproducible only on this MacBook Air.
On iMac (macOS Sequoia, Obsidian v1.9.12 installer 1.8.10), the same content pastes cleanly.


Additional information

1 Like

What I’m trying to do

Copy & paste content from ChatGPT into Obsidian, retaining all formatting with headers

works fine on my iMac Pro, iPad, and Android → but on Macbook Air, has been inserting extra asterixes (for markdown bolding) and spacing on/for lines with headers:

Pastes as:

## **Heading**

and several lines with yet more splits. i.e.:

have spent hours with ChatGPT trying to troubleshoot. seems we solved multiple times, but then issue reappears without explanation.

Things I have tried

what DID work temporarily was an adjustment to a custom theme, but then it’s back, and same thing with default theme.

have run numerous texts with Terminal and Apple Script → seems the issue is with Obsidian, not the computer’s clipboard.

have ensured it’s the same build and installer as on the iMac Pro.

and the formatting issue appears ONLY on the Macbook Air - exact same notes on other devices appear fine.

at the end of my rope with this. ChatGPT has had me chasing ghosts, telling me the problem is this and that, only to be proven wrong upon the next test it provides.

tried posting a bug report, but also don’t trust ChatGPT gave any of the right info. i don’t have enough coding knowledge/experience to really grasp the details of what the problems and solutions are here.

can ANYONE help break it down for me like i’m 5 to help figure out how to troubleshoot and solve why this is happening and how to fix?

:folded_hands::folded_hands::folded_hands:


lastly, ChatGPT’s attempted summarization:

:white_check_mark: What’s actually happening

  • When you copy content from ChatGPT and paste it into Obsidian (on your MacBook Air, Sequoia 15.6.1), headings get mangled.
    • Instead of a clean ## Heading, you get ## Heading.
    • Sometimes it even inserts extra line breaks.
  • This does not happen on your iMac Pro or Android devices.
    • There, the same content pastes as clean Markdown headings.
  • The issue persists even when:
    • You disable all Obsidian plugins.
    • You switch to the default theme.
    • You test across different browsers and the ChatGPT Mac app.

:white_check_mark: What we proved with clipboard inspection

  • On the MacBook Air, the clipboard stores multiple “flavors” of the copied text:
    • public.utf8-plain-text (plain Markdown)
    • public.rtf
    • public.html
  • Obsidian, when the setting “Convert pasted HTML to Markdown” is enabled, prefers the HTML flavor of the clipboard instead of the plain text.
    • And ChatGPT’s HTML flavor wraps headings with .
    • Obsidian’s HTML→Markdown converter then translates that into the broken ## Heading.
  • That’s why the bug is specific to this MacBook Air: its clipboard flavor resolution + Obsidian’s converter are interacting differently than on your other machines.

:white_check_mark: Root cause (with high certainty)

This is not a CSS theme issue and not ChatGPT changing its Markdown output.

It’s the combination of:

  1. ChatGPT’s clipboard export including bold tags around headings in the HTML flavor.
  2. Obsidian preferring HTML over plain text Markdown when pasting.
  3. Obsidian’s HTML→Markdown converter incorrectly keeping the bold markup (Heading) instead of treating the inside

    /

    as redundant.

That’s why you only see the extra on the MacBook Air, not elsewhere.


:white_check_mark: What to tell the Obsidian forum/devs

  • The bug is in Obsidian’s HTML→Markdown conversion: it mishandles

    Heading

    by converting it into # Heading instead of just # Heading.
  • Clipboard inspection shows the plain Markdown flavor (## Heading) is available, but Obsidian doesn’t use it when HTML→Markdown is enabled.
  • Request: Obsidian should strip redundant inside

    when converting HTML→Markdown, or prioritize the plain text Markdown flavor when it’s present.

:backhand_index_pointing_right: That is the clean, confident conclusion you can present in “human speak” on the forum:

  • “This isn’t my theme, isn’t plugins, isn’t ChatGPT randomly broken. The bug is in how Obsidian parses HTML clipboard data, specifically Heading.”

some extra info…

ive been attempting to troubleshoot this with ChatGPT for probably 6 hours total, jumping through hoops, at end of rope. i don’t have enough coding knowledge/experience to verify everything, though this seems to be some of the key info:

What (ChatGPT claims to be) happening:
• The system clipboard provides multiple flavors (plain text, RTF, HTML).
• Obsidian is choosing the HTML flavor.
• In that HTML, headings aren’t just Heading. They are Heading.
• Obsidian’s HTML→Markdown converter doesn’t normalize this, so it outputs ## Heading instead of ## Heading.

Why it (apparently) only happens here:
• On Android and on my iMac Pro, Obsidian seems to use the plain text Markdown flavor from the clipboard, so no issue.
• On this MacBook Air, it (apparently) prefers the HTML flavor, so the bug appears.

(Alleged) Root cause for devs:
• Obsidian’s HTML→Markdown converter should discard redundant or tags inside heading elements.
• Alternatively, Obsidian should prefer the plain text Markdown flavor when it exists, since that already contains clean Markdown.

(Allegedly), this is not a theme, CSS, or plugin problem. It’s strictly about how Obsidian handles HTML clipboard input when it contains bold tags inside headings.

Please don’t double-post.

I’ve merged your two posts. And I moved it to help, because I don’t believe this bug has anything to do with Obsidian. (It might.)

If I copy some output from ChatGPT, and look at the plain text (paste it into TextEdit as a plain text document, or Vim, or another plaintext editor), you’ll see the same asterisks.

I can’t explain why you only see it sometimes, depending on OS. Maybe there is an actual bug, or an anti-bug? Or maybe I am failing to analyze it because I’m looking through the lens of an OS bug. But I can verify I only see it sometimes from ChatGPT, depending on the prompt output.

If the html contains <strong></strong> then the asterisks are correct and should not be removed.

If you want to paste as plain text, there is the option in the context menu and you also use cmd/ctrl-shift-v.

re: the ‘strong’ thing… i’m not sure if this is something ChatGPT was hallucinating on. thing is, the asterixes are NOT correct. and this is ONLY happening on the Macbook Air. and even if/when it all copies in like that incorrectly so the headers get split up with all the extra spacing and asterixes, the headers still appear fine on other devices - none of those extras to be found in source view.

CGPT attempted giving me something to include in the bug report where the issue would be duplicable with that ‘strong’ code - BUT, when just copying it in directly to Obsidian myself, the same issue did NOT happen.

so i’m really not sure whether the whole mention of ‘strong’ is just another of its hallucinations, OR I’m not understanding it/something correctly.


re: plain text… that’d be the easiest - also doable by just turning off the ‘convert pasted html to markdown in editor’ - but not actually a fix or solution, and i want headers and all the editing.

The asterisk are correct because html <strong> is translated to **

Copy from chatgpt to and paste Clipboard Test

You will see the html that “chatgpt + the browser app you use” produce and and put on the clipboard when you copy.

noted. figured the bug report was that - following its formatting - while also needing help to try figure this out and provide more detail than fit in or was appropriate for the bug report itself. but shall keep all in one on any other matters from hereon in.

re: having to do with Obsidian… I’m not 100% certain either as have been through the ringer with ChatGPTs attempted troubleshooting, considering that could be A) formatting output of ChatGPT, B) clipboard behavior on the Macbook Air, C) Obsidian. though after numerous tests, it keeps pointing back to Obsidian. and the fact that the issue temporarily seemed fixed by changing something in a custom theme indicated that coulda been the case. (though the issue is back, with custom OR default theme).

and when i’ve tried to test by copying into Text Edit, Notes, or Byword - i dont get any asterixes or any header/markdown at all.

latest assessment - seeming to imply it may be a combination of ChatGPTs clipboard format + Obsidian’s converter on this particular mac (whether thats true or not, Im unsure):

1 Like

With TextEdit, are you talking plain-text mode, or rich text mode? If I paste directly into Vim, I see the asterisks:

### **Test heading for example**

And if I use that clipboard testing website, I see some extra unicode (or something) characters surrounding the html content in the clipboard.

If I remember, tomorrow I’ll try it on Windows and see if I can spot a difference.

upon first testing that, tried both and made no difference.

tried again now… seems there IS formatting applied, with line that’s supposed to be a header as “semibold” - not as literal ## Heading…

“…proves the ChatGPT app is only supplying RTF/HTML (bold runs), not Markdown. Obsidian is converting that RTF into ## Heading, which causes the bug.”

?


also before, was experiencing same thing whether text was copied from the ChatGPT app or ChatGPT within Orion or Brave browsers. NOW, seems to be only happening when coming from the ChatGPT app. not trusting it 100%, but this might potentially explain part of it…



Obsidian does not have an RTF to markdown converter. if RTF is in the clipboard, it’s ignored.

We only have an HTML to markdown converter.
I am 99.9% sure that what you see in the converted markdown was in the HTML that was placed in the clipboard by your other app.

I really don’t think asking the tool about itself is a very effective way to figure this out. I’m certainly not reading or considering any of that output as trustworthy.

I just tested on Windows 10, and the plain-text paste into Vim also includes the asterisks on the H3 output. No other header levels have the issue. I suggest reaching out to OpenAI support.

Another variable is which browser or app you are copying from, on each device. I am using Firefox in both of my tests. But again, this seems to have nothing to do with Obsidian.

## Fake headline here just to illustrate

### **Fake H3 headline just to illustrate**

... etc.

Yeah, I’ve run into the same thing. Copying from ChatGPT often brings in extra formatting that messes with Obsidian headers. Would be great if this got smoothed out.

there was a point it seemed to be happening whether using ChatGPT app, Orion or Brave browser… last round of tests, seemed to be just the ChatGPT - whereas was fine with the browsers.

Facing same issues and not only with headers, when copying from chatgpt app in macOS or iOS it also inserts blank lines after line breaks and I end up having to use vim :%s/… commands to avoid removing line by line manually. This does not happen if I paste gpt’s reply to vscode or neovim

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