<commit_before>AjaxEdit
========

*AjaxEdit* is a lightweight jQuery plugin written for [IP7’s
website](https://github.com/IP7/Website), used to edit some HTML sections using
Markdown.

This is currently under development.<commit_msg>Better README, +'How it works', +'Usage'<commit_after>AjaxEdit
========

*AjaxEdit* is a lightweight jQuery plugin written for [IP7’s
website](https://github.com/IP7/Website), to edit some HTML sections using
Markdown.

This is currently under development.


How it works
------------

This plugin makes AJAX calls to an URL to get/post the content. It works basically
this way:

1. The user want to edit an HTML region
2. *AjaxEdit* get the content from your API, in Markdown
3. The user edit the Markdown, and save
4. *AjaxEdit* post the content to your API, and get the compiled HTML back

Example of JSON content returned by your API:

```json
{
    'title' : {
        'html' : 'Foo <b>bar</b>',
        'text' : 'Foo **bar**'
    },

    'intro' : {
        'html' : 'Lorem <a href="#">ipsum</a>',
        'text' : 'Lorem [ipsum](#)'
    }
}
```


Usage
-----

Include `jquery.ajaxedit.js` in your page, *after* jQuery. Then use the
`.ajaxedit(options)` method. It takes one argument, either a string or an
object. You <u>must</u> provide a local URL (same domain) which will be
used as an API endpoint to get/post the content. It will throw an `Error` if no
URL is provided. You can provide it either as a string or in an object:

```js
// using a string
$( '#example' ).ajaxedit( '/api/example.json' );

// using an object
$( '#example' ).ajaxedit({

    url: '/api/example.json'

});
```

{'fraction_non_alphanumeric': 0.14101778050275904, 'fraction_numerical': 0.004904966278356836, 'mean_word_length': 3.398921832884097, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6996900', 'n_tokens_mistral': 526, 'n_tokens_neox': 506, 'n_words': 215}