Skip to content
Tanishq Sharma edited this page Nov 9, 2017 · 8 revisions

Welcome to the Marknish wiki!

About

Marknish is a markup language as well as an Android Library which makes it easy to render at your client side. With only a few tools, it can save as a String datatype in your backend/database and while rendering creates respective elements on the front end. It saves a huge amount of space!

Backend - Creating a render-ready code

In the current version Release, Marknish only supports 5 basic rendering elements.

  • Bullets

Rendering Ready Code: <n_bullet> Content </n_bullet>

  • Heading

Rendering Ready Code: <n_heading> This is a heading </n_heading>

  • Paragraph

Rendering Ready Code: <n_paragraph> This is a paragraph </n_paragraph>

  • Image

Rendering Ready Code:

Marknish uses Glide for efficient image loading.It's implementation has been added below in Android Client Implementation.

<n_image> This is a paragraph </n_image>

  • Separator

separator tag has not been included in the rendering ready code format. However, it is usable in the Android Library Client.

Android Client Implementation

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}

Add the dependency to your add module build.gradle file:

	dependencies {
	        compile 'com.github.tanishqsh:marknish:v1.1'
	}


Marknish uses Glide for efficient image loading

Add Glide to your build.gradle

repositories {
  mavenCentral()
  maven { url 'https://maven.google.com' }
}

dependencies {
  compile 'com.github.bumptech.glide:glide:4.3.1'
  annotationProcessor 'com.github.bumptech.glide:compiler:4.3.1'
}

Get the scrollview element from the XMl.

ScrollView container = findViewbyId(R.id.container);

Get the render-ready code from the server or any external place. Make sure the render ready codes follow the syntax.

String render_ready_code = "<n_heading> This is a heading </n_heading>. <n_paragraph> We are going to talk about some random things in order to make this paragraph a bit longer, bigger and a great one at that. </n_paragraph>. One thing to note is, anything outside the brackets and tags will be ignored. So, let us try with the bullets. <n_bullet> This is a bullet point </n_bullet>. <n_paragraph> Also, we have image support as well </n_paragraph> <n_image> http://via.placeholder.com/350x150 </n_image>"

Create an object of NishParser

NishParser nP = new NishParser(getContext());

Add the rendered view in the container.

container.addView(nP.ReturnView(render_ready_code));

DONE!