Preview content via the API

zalambar
edited October 2011 in API Discussion
Obsidian Portal users should be accustomed to writing textile and are likely to create textile based input via applications which take advantage of the API. As application authors we don't and shouldn't need to know which version of which textile parser Obsidian Portal is currently using or what the filtering rules applied to inline html currently are. However it would be nice to allow our application's users to preview content they are about to submit.

Therefore I would like to see an API call which accepts text input and returns whatever html results from parsing the input as textile and applying whatever restrictions on inline HTML Obsidian Portal currently thinks are necessary. I think it would make sense for that response to be a full html page and include at least a reasonable set of stylesheets for the default look and feel of html elements on the Obsidian Portal website. However even a context free snippet of html might be helpful in allowing applications to preview the structure of the content a user is attempting to post.

Comments

  • GamingMegaverse
    GamingMegaverse
    Posts: 3,001
    wow, a lot of detailed requests... I would settle for the original- what version of textile, and what filtering rules apply?

    Just trying to help out.

  • zalambar
    Posts: 14 edited October 2011
    p. Since the Textile reference on wiki pages is to "redcloth.org":redcloth.org hopefully that means Obsidian Portal is using RedCloth 4.2.2 or later but I don't see that stated for sure anywhere. I'd also expect that to change as development of both Obsidian Portal and RedCloth continue. Hopefully updates would not change the Textile parsing behavior but I'd rather not need to make sure that I keep my RedCloth gem version (or worse my Textile parser for some other language) in sync with Obsidian Portal's.

    p. The allows HTML tag and attribute list is available at "http://www.obsidianportal.com/tutorials/allowed-html-tags":http://www.obsidianportal.com/tutorials/allowed-html-tags but again I expect that to change over time. If someone convinces Micah to allow ==no == tags (not currently in the allowed list) then I don't want any users of my app to become frustrated that they cannot add audio elements to their pages via my application because I failed to keep up with changes to that list.

    p. Playing around with the idea for this request I think I'm looking for something like the following:

    h3. Request

    *URL:* http://api.obsidianportal.com/v1/preview
    *HTTP Verb:* POST
    *Requires Authentication:* whatever

    _Request Body_
    @{
    'body' : 'textile and raw html to preview'
    'campaign_id' : 'optional, the campaign to evaluate this content within allowing the preview to include campaign specific styling or markup restricted to ascendant campaigns.'
    'type' : 'optional, Post/WikiPage/Character/whatever if we're going to need to consider different rules for different types of editable content'
    }@

    _Response_
    @{
    'body' : 'textile version of the preview which would be saved by OP, may have escaped forbidden markup or stripped forbidden attributes'
    'body_html' : 'html formatted version of the body'
    'stylesheets' : [array of stylesheet urls which will apply to this content]
    'errors' : {
    notify the requestor of content escaped or stripped from the body
    }
    }@
    Post edited by zalambar on
Sign In or Register to comment.

April 2024
Season of Strife

Read the feature post on the blog
Return to Obsidian Portal

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Discussions