How to remove anchor tags in Confluence cloud?

I've got a wiki in confluence cloud in which someone apparently added anchor tags to several paragraphs. 

The page now renders that anchor'd text in a different color, and gives it an underline on hover. 

Is there a way to remove the anchor tags without copy/pasting the text out and back in to the document? Some of the text has other formatting that would be tedious to recreate.

This is the HTML of a portion of the page in question, with the anchor tags across multiple elements:

<li><em>CSS</em>:&nbsp;<a href="">scss</a></li>
<li><em>JavaScript</em>:&nbsp;<a href="">CoffeeScript</a></li></ul>
<h2><a name="rails_structure">Rails structure</a></h2>
<p><a name="rails_structure">The standard Rails directory structure is used, but you'll find certain files in places you might not expect. The most important directory is&nbsp;<code>app</code>, that is where you'll find the majority of the website&rsquo;s application code. Here&rsquo;s a truncated directory hierarchy:</a></p>
<pre><a name="rails_structure"><code>scribd
├── app
│&nbsp;&nbsp; ├── controllers
│&nbsp;&nbsp; ├── helpers
│&nbsp;&nbsp; ├── models
│&nbsp;&nbsp; └── views
├── config
├── doc
├── lib
├── public
└── vendor
<p><a name="rails_structure">In the&nbsp;<code>views</code>&nbsp;directory you'll find the views (the files responsible for rendering HTML) a

There's an add-on for editing source, but it costs $82 per month for the cloud version, which is way more than I'm willing to pay to solve this.





1 answer

0 votes
Stephen Deutsch Community Champion Jul 03, 2017

This might work for you:

    url: contextPath + "/rest/api/content/" + AJS.params.pageId + "?,version,ancestors",
    success: function(response) {
        bodyText = "<xml>" + + "</xml>";
        xmlBodyText = bodyText
        xmlDoc = jQuery.parseXML(xmlBodyText);
        xml = jQuery(xmlDoc);
        anchor = xml.find('a[name="rails_structure"]');
        jQuery(anchor).each(function() {
        ser = new XMLSerializer();
        newBodyText = ser.serializeToString(xml[0]);
        newBodyText = newBodyText
            .split("/>").join(" />")
            .split("qquuoott").join("&quot;"); = newBodyText;
        response.version.number += 1;
            contentType: 'application/json',
            type: 'PUT',
            url: contextPath + "/rest/api/content/" + AJS.params.pageId,
            data: JSON.stringify(response),
            success: function(response) {
            error: function(response) {

You need to go to the page that you want to change and then copy and paste the code in the browser console (usually opened by pressing F12 on Windows, or Alt+Option+I on Mac).

If everything goes well, it should reload with with the changes visible. In case it messed something up, you should be able to restore your page from the history, but it should work (I tested it on a sample page).

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Thursday in Confluence

What are your project planning tips?

Hello Community,  Jessica here from the Confluence product marketing team! Today I wanted to get your takes on project planning –– what works, what doesn’t, how do you know if you’re doing it r...

135 views 0 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you