Index: src/main/java/com/xpn/xwiki/internal/renderer/xhtml/ViewXHTMLBlockRenderer.java
===================================================================
--- src/main/java/com/xpn/xwiki/internal/renderer/xhtml/ViewXHTMLBlockRenderer.java	(revision 0)
+++ src/main/java/com/xpn/xwiki/internal/renderer/xhtml/ViewXHTMLBlockRenderer.java	(revision 0)
@@ -0,0 +1,49 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xpn.xwiki.internal.renderer.xhtml;
+
+import org.xwiki.component.annotation.Component;
+import org.xwiki.component.annotation.Requirement;
+import org.xwiki.rendering.internal.renderer.AbstractBlockRenderer;
+import org.xwiki.rendering.renderer.PrintRendererFactory;
+
+/**
+ * Block Renderer for Annotated XHTML syntax. To be used to convert XDOM into XHTML.
+ * 
+ * @version $Id: AnnotatedXHTMLBlockRenderer.java 22455 2009-08-10 08:52:03Z sdumitriu $
+ * @since 2.0M3
+ */
+@Component("viewxhtml/1.0")
+public class ViewXHTMLBlockRenderer extends AbstractBlockRenderer
+{
+    @Requirement("viewxhtml/1.0")
+    private PrintRendererFactory viewXHTMLRendererFactory;
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.xwiki.rendering.internal.renderer.AbstractBlockRenderer#getPrintRendererFactory()
+     */
+    @Override
+    protected PrintRendererFactory getPrintRendererFactory()
+    {
+        return this.viewXHTMLRendererFactory;
+    }
+}
Index: src/main/java/com/xpn/xwiki/internal/renderer/xhtml/ViewXHTMLChainingRenderer.java
===================================================================
--- src/main/java/com/xpn/xwiki/internal/renderer/xhtml/ViewXHTMLChainingRenderer.java	(revision 0)
+++ src/main/java/com/xpn/xwiki/internal/renderer/xhtml/ViewXHTMLChainingRenderer.java	(revision 0)
@@ -0,0 +1,84 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xpn.xwiki.internal.renderer.xhtml;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.xwiki.rendering.internal.renderer.xhtml.XHTMLChainingRenderer;
+import org.xwiki.rendering.listener.HeaderLevel;
+import org.xwiki.rendering.listener.chaining.ListenerChain;
+import org.xwiki.rendering.renderer.xhtml.XHTMLImageRenderer;
+import org.xwiki.rendering.renderer.xhtml.XHTMLLinkRenderer;
+
+/**
+ * Convert listener events to view XHTML. See {@link ViewXHTMLChainingRenderer} for more details on what view XHTML is.
+ * 
+ * @version $Id: AnnotatedXHTMLChainingRenderer.java 22485 2009-08-10 23:43:51Z vmassol $
+ * @since 2.3M1
+ */
+public class ViewXHTMLChainingRenderer extends XHTMLChainingRenderer
+{
+    /**
+     * @param linkRenderer the object to render link events into XHTML. This is done so that it's pluggable because link
+     *            rendering depends on how the underlying system wants to handle it. For example for XWiki we check if
+     *            the document exists, we get the document URL, etc.
+     * @param imageRenderer the object to render image events into XHTML. This is done so that it's pluggable because
+     *            image rendering depends on how the underlying system wants to handle it. For example for XWiki we
+     *            check if the image exists as a document attachments, we get its URL, etc.
+     * @param listenerChain the chain of listener filters used to compute various states
+     */
+    public ViewXHTMLChainingRenderer(XHTMLLinkRenderer linkRenderer, XHTMLImageRenderer imageRenderer,
+        ListenerChain listenerChain)
+    {
+        super(linkRenderer, imageRenderer, listenerChain);
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.xwiki.rendering.internal.renderer.xhtml.XHTMLChainingRenderer#beginHeader(org.xwiki.rendering.listener.HeaderLevel,
+     *      java.lang.String, java.util.Map)
+     */
+    @Override
+    public void beginHeader(HeaderLevel level, String id, Map<String, String> parameters)
+    {
+        Map<String, String> newParameters = parameters;
+
+        if (!getBlockState().isInMacro()) {
+            newParameters = new LinkedHashMap<String, String>(parameters);
+
+            String cssClass = newParameters.get("class");
+
+            if (cssClass != null) {
+                cssClass += "editablesection";
+            } else {
+                cssClass = "editablesection";
+            }
+
+            // mark the header as editable section
+            newParameters.put("class", cssClass);
+
+            // FIXME: provide the number too ?
+        }
+
+        super.beginHeader(level, id, newParameters);
+    }
+}
Index: src/main/java/com/xpn/xwiki/internal/renderer/xhtml/ViewXHTMLRenderer.java
===================================================================
--- src/main/java/com/xpn/xwiki/internal/renderer/xhtml/ViewXHTMLRenderer.java	(revision 0)
+++ src/main/java/com/xpn/xwiki/internal/renderer/xhtml/ViewXHTMLRenderer.java	(revision 0)
@@ -0,0 +1,82 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package com.xpn.xwiki.internal.renderer.xhtml;
+
+import org.xwiki.component.annotation.Component;
+import org.xwiki.component.annotation.InstantiationStrategy;
+import org.xwiki.component.annotation.Requirement;
+import org.xwiki.component.descriptor.ComponentInstantiationStrategy;
+import org.xwiki.component.phase.Initializable;
+import org.xwiki.component.phase.InitializationException;
+import org.xwiki.rendering.listener.chaining.BlockStateChainingListener;
+import org.xwiki.rendering.listener.chaining.ListenerChain;
+import org.xwiki.rendering.listener.chaining.EmptyBlockChainingListener;
+import org.xwiki.rendering.renderer.AbstractChainingPrintRenderer;
+import org.xwiki.rendering.renderer.xhtml.XHTMLImageRenderer;
+import org.xwiki.rendering.renderer.xhtml.XHTMLLinkRenderer;
+
+/**
+ * Generates XHTML to use in XWiki view UI.
+ * <ul>
+ * <li>insert section edition link near proper headers</li>
+ * </ul>
+ * 
+ * @version $Id: XHTMLRenderer.java 22654 2009-08-13 11:28:57Z vmassol $
+ * @since 2.3M1
+ */
+@Component("viewxhtml/1.0")
+@InstantiationStrategy(ComponentInstantiationStrategy.PER_LOOKUP)
+public class ViewXHTMLRenderer extends AbstractChainingPrintRenderer implements Initializable
+{
+    /**
+     * To render link events into XHTML. This is done so that it's pluggable because link rendering depends on how the
+     * underlying system wants to handle it. For example for XWiki we check if the document exists, we get the document
+     * URL, etc.
+     */
+    @Requirement
+    private XHTMLLinkRenderer linkRenderer;
+
+    /**
+     * To render image events into XHTML. This is done so that it's pluggable because image rendering depends on how the
+     * underlying system wants to handle it. For example for XWiki we check if the image exists as a document
+     * attachments, we get its URL, etc.
+     */
+    @Requirement
+    private XHTMLImageRenderer imageRenderer;
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see Initializable#initialize()
+     * @since 2.0M3
+     */
+    public void initialize() throws InitializationException
+    {
+        ListenerChain chain = new ListenerChain();
+        setListenerChain(chain);
+
+        // Construct the listener chain in the right order. Listeners early in the chain are called before listeners
+        // placed later in the chain.
+        chain.addListener(this);
+        chain.addListener(new BlockStateChainingListener(chain));
+        chain.addListener(new EmptyBlockChainingListener(chain));
+        chain.addListener(new ViewXHTMLChainingRenderer(this.linkRenderer, this.imageRenderer, chain));
+    }
+}
