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>: <a href="http://sass-lang.com/">scss</a></li> <li><em>JavaScript</em>: <a href="http://coffeescript.org/">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 <code>app</code>, that is where you'll find the majority of the website’s application code. Here’s a truncated directory hierarchy:</a></p> <pre><a name="rails_structure"><code>scribd ├── app │ ├── controllers │ ├── helpers │ ├── models │ └── views ├── config ├── doc ├── lib ├── public └── vendor </code></a></pre> <p><a name="rails_structure">In the <code>views</code> 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.
This might work for you:
jQuery.ajax({ url: contextPath + "/rest/api/content/" + AJS.params.pageId + "?expand=body.storage,version,ancestors", success: function(response) { console.log(response); bodyText = "<xml>" + response.body.storage.value + "</xml>"; xmlBodyText = bodyText .split("ac:").join("ac--") .split("ri:").join("ri--") .split(" ").join("nnbbsspp") .split(""").join("qquuoott"); xmlDoc = jQuery.parseXML(xmlBodyText); xml = jQuery(xmlDoc); anchor = xml.find('a[name="rails_structure"]'); jQuery(anchor).each(function() { jQuery(this).replaceWith(this.innerHTML); }); ser = new XMLSerializer(); newBodyText = ser.serializeToString(xml[0]); newBodyText = newBodyText .split("ac--").join("ac:") .split("ri--").join("ri:") .split("nnbbsspp").join(" ") .split("<xml>").join("") .split("</xml>").join("") .split("/>").join(" />") .split("qquuoott").join("""); response.body.storage.value = newBodyText; response.version.number += 1; jQuery.ajax({ contentType: 'application/json', type: 'PUT', url: contextPath + "/rest/api/content/" + AJS.params.pageId, data: JSON.stringify(response), success: function(response) { location.reload(); }, error: function(response) { console.log(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).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.