Search 1.9 billion lines of Odoo code on GitHub

web_widget_html_markdown

Author: Giovanni Francesco Capalbo, Therp B.V.Komit, Sudokeys, Sunflower IT, Odoo Community Association (OCA)
License: AGPL-3
Branch: 14.0-web_widget_html_markdown_monodirectional
Repository: gfcapalbo/web
Dependencies: web, and web_editor
Languages: CSS (16, 0.3%), HTML (360, 6.1%), JavaScript (5414, 91.0%), Python (23, 0.4%), XML (31, 0.5%), and reStructuredText (103, 1.7%)
Other branches: 13.0-web_widget_html_markdown, and 14.0-web_widget_html_markdown

<h1 class="title">Web Widget Html Markdown Unidirectional</h1> <p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/web/tree/14.0/web_widget_html_markdown"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-14-0/web-14-0-web_widget_html_markdown"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/162/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <a name="behaviour-of-the-module-and-best-practices"></a> <h2>Behaviour of the module and best practices</h2> <ul> <li><p class="first">In readonly mode, the widget renders as Html</p> </li> <li><p class="first">In editable mode, there is a switcher to choose if the source should be HTML or Markdown. If HTML, it shows the HTML edit widget. If Markdown, it shows a markdown widget. When done editing, it will save in the field as Html, no matter which widget is chosen.</p> </li> <li><p class="first">The Module converts only from markdown to html, so if i am writing HTML and then switch to markdown, i will lose all my HTML. Therefore the module is called &quot;unidirectional&quot; the conversion will only be markdown--&gt;Html.</p> <blockquote> <ul class="simple"> <li>when switching from markdown to HTML: the markdown will always be converted and saved in html.</li> <li>if I switch again from HTML to markdown, i will lose all my html again, only the part i wrote in markdown will be preserved.</li> </ul> </blockquote> </li> <li><p class="first">Module provides a warning &quot;You will lose all your current HTML if you switch to markdown&quot;</p> </li> <li><dl class="first docutils"> <dt>Best usages of this module:</dt> <dd><ol class="first last arabic simple"> <li>As normal Html editor, only HTML</li> <li>Write some markdown and then add some HTML. ( will cause loss of HTML if you edit markdown again)</li> <li>Only markdown.</li> </ol> </dd> </dl> </li> <li><p class="first">RE-editing pure markdown content is LOSSLESS because we preserve the markdown content in a special tag.</p> </li> <li><p class="first">Every switch to markdown will cause destruction of HTML. Html Can Be added after writing Markdown part but will always be deleted.</p> </li> </ul> <a name="utility-of-this-module-vs-web-widget-text-markdown"></a> <h2>Utility of this module vs web_widget_text_markdown</h2> <p>Why this module when web_widget_text_markdown already exists? Mainly because it is designed to work on Text fields, and most fields within Odoo are HTML fields for example: mail content, project.task description etc. Although you could develop a custom module that overrides these fields to be Text fields and render them on-screen as HTML, this rendering would not be done when the field is for example used in sending out a mail or fetching the field content through Odoo API. In these cases this widget comes in handy because it is plug-and-play: the field type and content remains as HTML, but you can choose to edit it with a markdown widget.</p> <p><strong>Table of contents</strong></p> <a name="usage"></a> <h2>Usage</h2> <p>Your XML form view definition should contain:</p> <blockquote> ... &lt;field name=&quot;field_name&quot; widget=&quot;html_markdown_unidirectional&quot;/&gt; ...</blockquote> <p>The widget is called unidiectional because itt is used on a Html field to edit HTML or Markdown, but the conversion is unidirectional, ONLY from Markdown to HTML.</p> <p>This will replace the default Html widget by the new Markdown/HTML widget and allow the field to be edited as Markdown or HTML, depending on the user's choice.</p> <a name="known-issues-roadmap"></a> <h2>Known issues / Roadmap</h2> <ul class="simple"> <li>HTML Will be lost when passing from Html to markdown</li> </ul> <a name="bug-tracker"></a> <h2>Bug Tracker</h2> <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed <a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_widget_html_markdown%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <p>Do not contact contributors directly about support or help with technical issues.</p> <a name="credits"></a> <h2>Credits</h2> <a name="authors"></a> <h3>Authors</h3> <ul class="simple"> <li>Giovanni Francesco Capalbo</li> <li>Therp B.V.Komit</li> <li>Sudokeys</li> <li>Sunflower IT</li> </ul> <a name="contributors"></a> <h3>Contributors</h3> <ul class="simple"> <li>Tom Blauwendraat &lt;<a class="reference external" href="mailto:tom&#64;sunflowerweb.nl">tom&#64;sunflowerweb.nl</a>&gt;</li> <li>Kevin Kamau &lt;<a class="reference external" href="mailto:kevin&#64;sunflowerweb.nl">kevin&#64;sunflowerweb.nl</a>&gt;</li> <li>Giovanni Francesco Capalbo &lt;<a class="reference external" href="mailto:giovanni&#64;therp.nl">giovanni&#64;therp.nl</a>&gt;</li> </ul> <a name="other-credits"></a> <h3>Other credits</h3> <ul class="simple"> <li>Therp B.V. <a class="reference external" href="https://therp.nl">https://therp.nl</a></li> </ul> <a name="maintainers"></a> <h3>Maintainers</h3> <p>This module is maintained by the OCA.</p> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <p>OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/14.0/web_widget_html_markdown">OCA/web</a> project on GitHub.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>