Skip to content

🐛 Fix copy button copying HTML tags from termynal command lines#15941

Open
shreyash0k wants to merge 1 commit into
fastapi:masterfrom
shreyash0k:fix-copy-button-html-tags
Open

🐛 Fix copy button copying HTML tags from termynal command lines#15941
shreyash0k wants to merge 1 commit into
fastapi:masterfrom
shreyash0k:fix-copy-button-html-tags

Conversation

@shreyash0k

Copy link
Copy Markdown

I reported this bug in this discussion: #15700

Issue: on several docs pages, the copy button on termynal terminal blocks copies HTML styling tags into the clipboard instead of the plain shell command. For example, on https://fastapi.tiangolo.com/fastapi-cli/ copying the first terminal block gives <font color="#4E9A06">fastapi</font> dev instead of fastapi dev.

Fix: the command lines in the markdown can contain HTML styling tags (e.g. <font color="...">). custom.js builds a hidden code element with the raw input lines for the copy button to read, so the tags end up in the clipboard. This change extracts only the plain text when building that element, the same way Termynal itself does when typing the command lines. This keeps the formatting in the markdown source (so it can still be rendered in the future) and fixes all translated docs at once.

Testing: tested locally with the docs live server on all the affected pages (/fastapi-cli/, /tutorial/, /tutorial/first-steps/, /deployment/manually/, /deployment/server-workers/), including commands that also contain <u> tags. The copy button now copies clean commands and the terminal animation renders as before.

Made with Cursor

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added the docs Documentation about how to use FastAPI label Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

@YuriiMotov YuriiMotov changed the title 🐛 Fix copy button copying HTML tags from termynal command lines in custom.js 🐛 Fix copy button copying HTML tags from termynal command lines Jul 6, 2026

@YuriiMotov YuriiMotov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation about how to use FastAPI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants