refactory-id / bootstrap-markdown

Bootstrap plugin for markdown editing
Apache License 2.0
1.99k stars 371 forks source link

Displaying data from the database #151

Closed majimboo closed 9 years ago

majimboo commented 9 years ago

After using the editor to enter data, how about displaying the data without showing the editor? How would one do that?

lodev09 commented 9 years ago

I think there is an option to let you initialize the plugin on preview mode

acrobat commented 9 years ago

Yes indeed there is an initialstate option added in #64

Possible values: initialstate: 'editor' or 'preview'

lodev09 commented 9 years ago

@acrobat thanks for pointing that out :)

majimboo commented 9 years ago

Aah, can I ask for a example usage? Thanks.

acrobat commented 9 years ago

@majimboo here is an example ;)

majimboo commented 9 years ago

@acrobat , cheers, oddly it still shows the editor. I just want to display something from the database. :D

acrobat commented 9 years ago

Hmm then I don't understand your question.. This option opens the editor with the preview mode default enabled (you can also disable the other actions) this way the editor is just a preview screen

lodev09 commented 9 years ago

If you are concerned about the editor "layout" then you should use your markdown parser (not this plugin) to just parse the string and put it in a div

majimboo commented 9 years ago

Actually, I have markdown data in the database. That was saved using this library. Now, I want to display that data to the user. Ofcourse I do not want the user to edit the data, nor do I want to show the editor. I just want to show the HTML of the markdown.

lodev09 commented 9 years ago

@majimboo see my comment above

Additionally, if you want to have an option to edit the div content, then you can use this plugin. see more example here: http://www.codingdrama.com/bootstrap-markdown/

majimboo commented 9 years ago

Yah, I did that problem now is this plugin is saving new lines as special characters and markdownjs seems to expect \n for new lines. So now all my parsed markdown has no line breaks.