1 line
9.9 KiB
JavaScript
1 line
9.9 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[33],{270:function(t,a,n){"use strict";n.r(a);var s=n(0),e=Object(s.a)({},function(){var t=this,a=t.$createElement,n=t._self._c||a;return n("div",{staticClass:"content"},[t._m(0),t._v(" "),n("LegacyWarning"),t._v(" "),n("div",{staticClass:"tip custom-block"},[n("p",{staticClass:"custom-block-title"},[t._v("Installation")]),t._v(" "),n("p",[t._v("Please follow "),n("router-link",{attrs:{to:"/docs/v3/install.html"}},[t._v("installation")]),t._v(" instructions\nto learn how to add "),n("code",[t._v("Markwon")]),t._v(" to your project")],1)]),t._v(" "),t._m(1),t._v(" "),t._m(2),t._v(" "),t._m(3),t._m(4),t._v(" "),t._m(5),n("div",{staticClass:"warning custom-block"},[n("p",{staticClass:"custom-block-title"},[t._v("3.x.x migration")]),t._v(" "),n("p",[t._v("Starting with "),n("Badge",{attrs:{text:"3.0.0"}}),t._v(" version Markwon no longer relies on static\nutility methods. To learn more about migrating existing applications\nrefer to "),n("router-link",{attrs:{to:"/docs/v3/migration-2-3.html"}},[t._v("migration")]),t._v(" section.")],1)]),t._v(" "),t._m(6),t._v(" "),t._m(7),t._v(" "),t._m(8),t._m(9),t._v(" "),n("p",[t._v("This section is kept due to historical reasons. Starting with version "),n("Badge",{attrs:{text:"3.0.0"}}),t._v("\nthe amount of magic is reduced. To leverage your "),n("code",[t._v("Markwon")]),t._v(" usage a concept of "),n("code",[t._v("Plugin")]),t._v("\nis introduced which helps to extend default behavior in a simple and "),n("em",[t._v("no-breaking-the-flow")]),t._v(" manner.\nHead to the "),n("router-link",{attrs:{to:"/docs/v3/core/plugins.html"}},[t._v("next section")]),t._v(" to know more.")],1)],1)},[function(){var t=this.$createElement,a=this._self._c||t;return a("h1",{attrs:{id:"getting-started"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#getting-started","aria-hidden":"true"}},[this._v("#")]),this._v(" Getting started")])},function(){var t=this.$createElement,a=this._self._c||t;return a("h2",{attrs:{id:"quick-one"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#quick-one","aria-hidden":"true"}},[this._v("#")]),this._v(" Quick one")])},function(){var t=this.$createElement,a=this._self._c||t;return a("p",[this._v("This is the most simple way to set markdown to a "),a("code",[this._v("TextView")]),this._v(" or any of its siblings:")])},function(){var t=this,a=t.$createElement,n=t._self._c||a;return n("div",{staticClass:"language-java extra-class"},[n("pre",{pre:!0,attrs:{class:"language-java"}},[n("code",[n("span",{attrs:{class:"token comment"}},[t._v("// obtain an instance of Markwon")]),t._v("\n"),n("span",{attrs:{class:"token keyword"}},[t._v("final")]),t._v(" Markwon markwon "),n("span",{attrs:{class:"token operator"}},[t._v("=")]),t._v(" Markwon"),n("span",{attrs:{class:"token punctuation"}},[t._v(".")]),n("span",{attrs:{class:"token function"}},[t._v("create")]),n("span",{attrs:{class:"token punctuation"}},[t._v("(")]),t._v("context"),n("span",{attrs:{class:"token punctuation"}},[t._v(")")]),n("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),n("span",{attrs:{class:"token comment"}},[t._v("// set markdown")]),t._v("\nmarkwon"),n("span",{attrs:{class:"token punctuation"}},[t._v(".")]),n("span",{attrs:{class:"token function"}},[t._v("setMarkdown")]),n("span",{attrs:{class:"token punctuation"}},[t._v("(")]),t._v("textView"),n("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" "),n("span",{attrs:{class:"token string"}},[t._v('"**Hello there!**"')]),n("span",{attrs:{class:"token punctuation"}},[t._v(")")]),n("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])])},function(){var t=this.$createElement,a=this._self._c||t;return a("p",[this._v("The most simple way to obtain markdown to be applied "),a("em",[this._v("somewhere")]),this._v(" else:")])},function(){var t=this,a=t.$createElement,n=t._self._c||a;return n("div",{staticClass:"language-java extra-class"},[n("pre",{pre:!0,attrs:{class:"language-java"}},[n("code",[n("span",{attrs:{class:"token comment"}},[t._v("// obtain an instance of Markwon")]),t._v("\n"),n("span",{attrs:{class:"token keyword"}},[t._v("final")]),t._v(" Markwon markwon "),n("span",{attrs:{class:"token operator"}},[t._v("=")]),t._v(" Markwon"),n("span",{attrs:{class:"token punctuation"}},[t._v(".")]),n("span",{attrs:{class:"token function"}},[t._v("create")]),n("span",{attrs:{class:"token punctuation"}},[t._v("(")]),t._v("context"),n("span",{attrs:{class:"token punctuation"}},[t._v(")")]),n("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),n("span",{attrs:{class:"token comment"}},[t._v("// parse markdown and create styled text")]),t._v("\n"),n("span",{attrs:{class:"token keyword"}},[t._v("final")]),t._v(" Spanned markdown "),n("span",{attrs:{class:"token operator"}},[t._v("=")]),t._v(" markwon"),n("span",{attrs:{class:"token punctuation"}},[t._v(".")]),n("span",{attrs:{class:"token function"}},[t._v("toMarkdown")]),n("span",{attrs:{class:"token punctuation"}},[t._v("(")]),n("span",{attrs:{class:"token string"}},[t._v('"**Hello there!**"')]),n("span",{attrs:{class:"token punctuation"}},[t._v(")")]),n("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),n("span",{attrs:{class:"token comment"}},[t._v("// use it")]),t._v("\nToast"),n("span",{attrs:{class:"token punctuation"}},[t._v(".")]),n("span",{attrs:{class:"token function"}},[t._v("makeText")]),n("span",{attrs:{class:"token punctuation"}},[t._v("(")]),t._v("context"),n("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" markdown"),n("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Toast"),n("span",{attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LENGTH_LONG"),n("span",{attrs:{class:"token punctuation"}},[t._v(")")]),n("span",{attrs:{class:"token punctuation"}},[t._v(".")]),n("span",{attrs:{class:"token function"}},[t._v("show")]),n("span",{attrs:{class:"token punctuation"}},[t._v("(")]),n("span",{attrs:{class:"token punctuation"}},[t._v(")")]),n("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])])},function(){var t=this.$createElement,a=this._self._c||t;return a("h2",{attrs:{id:"longer-one"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#longer-one","aria-hidden":"true"}},[this._v("#")]),this._v(" Longer one")])},function(){var t=this.$createElement,a=this._self._c||t;return a("p",[this._v("With explicit "),a("code",[this._v("parse")]),this._v(" and "),a("code",[this._v("render")]),this._v(" methods:")])},function(){var t=this,a=t.$createElement,n=t._self._c||a;return n("div",{staticClass:"language-java extra-class"},[n("pre",{pre:!0,attrs:{class:"language-java"}},[n("code",[n("span",{attrs:{class:"token comment"}},[t._v("// obtain an instance of Markwon")]),t._v("\n"),n("span",{attrs:{class:"token keyword"}},[t._v("final")]),t._v(" Markwon markwon "),n("span",{attrs:{class:"token operator"}},[t._v("=")]),t._v(" Markwon"),n("span",{attrs:{class:"token punctuation"}},[t._v(".")]),n("span",{attrs:{class:"token function"}},[t._v("create")]),n("span",{attrs:{class:"token punctuation"}},[t._v("(")]),t._v("context"),n("span",{attrs:{class:"token punctuation"}},[t._v(")")]),n("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),n("span",{attrs:{class:"token comment"}},[t._v("// parse markdown to commonmark-java Node")]),t._v("\n"),n("span",{attrs:{class:"token keyword"}},[t._v("final")]),t._v(" Node node "),n("span",{attrs:{class:"token operator"}},[t._v("=")]),t._v(" markwon"),n("span",{attrs:{class:"token punctuation"}},[t._v(".")]),n("span",{attrs:{class:"token function"}},[t._v("parse")]),n("span",{attrs:{class:"token punctuation"}},[t._v("(")]),n("span",{attrs:{class:"token string"}},[t._v('"Are **you** still there?"')]),n("span",{attrs:{class:"token punctuation"}},[t._v(")")]),n("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),n("span",{attrs:{class:"token comment"}},[t._v("// create styled text from parsed Node")]),t._v("\n"),n("span",{attrs:{class:"token keyword"}},[t._v("final")]),t._v(" Spanned markdown "),n("span",{attrs:{class:"token operator"}},[t._v("=")]),t._v(" markwon"),n("span",{attrs:{class:"token punctuation"}},[t._v(".")]),n("span",{attrs:{class:"token function"}},[t._v("render")]),n("span",{attrs:{class:"token punctuation"}},[t._v("(")]),t._v("node"),n("span",{attrs:{class:"token punctuation"}},[t._v(")")]),n("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),n("span",{attrs:{class:"token comment"}},[t._v("// use it on a TextView")]),t._v("\nmarkwon"),n("span",{attrs:{class:"token punctuation"}},[t._v(".")]),n("span",{attrs:{class:"token function"}},[t._v("setParsedMarkdown")]),n("span",{attrs:{class:"token punctuation"}},[t._v("(")]),t._v("textView"),n("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" markdown"),n("span",{attrs:{class:"token punctuation"}},[t._v(")")]),n("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n\n"),n("span",{attrs:{class:"token comment"}},[t._v("// or a Toast")]),t._v("\nToast"),n("span",{attrs:{class:"token punctuation"}},[t._v(".")]),n("span",{attrs:{class:"token function"}},[t._v("makeText")]),n("span",{attrs:{class:"token punctuation"}},[t._v("(")]),t._v("context"),n("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" markdown"),n("span",{attrs:{class:"token punctuation"}},[t._v(",")]),t._v(" Toast"),n("span",{attrs:{class:"token punctuation"}},[t._v(".")]),t._v("LENGTH_LONG"),n("span",{attrs:{class:"token punctuation"}},[t._v(")")]),n("span",{attrs:{class:"token punctuation"}},[t._v(".")]),n("span",{attrs:{class:"token function"}},[t._v("show")]),n("span",{attrs:{class:"token punctuation"}},[t._v("(")]),n("span",{attrs:{class:"token punctuation"}},[t._v(")")]),n("span",{attrs:{class:"token punctuation"}},[t._v(";")]),t._v("\n")])])])},function(){var t=this.$createElement,a=this._self._c||t;return a("h2",{attrs:{id:"no-magic-one"}},[a("a",{staticClass:"header-anchor",attrs:{href:"#no-magic-one","aria-hidden":"true"}},[this._v("#")]),this._v(" No magic one")])}],!1,null,null,null);e.options.__file="getting-started.md";a.default=e.exports}}]); |