Browse Source

update docs

closes #72
pull/82/head
Aaron Parecki 8 years ago
parent
commit
d2827d5b0a
No known key found for this signature in database GPG Key ID: 276C2817346D6056
  1. 34
      views/docs/editor.php

34
views/docs/editor.php

@ -13,32 +13,46 @@
<p>If your Micropub server supports a <a href="https://www.w3.org/TR/micropub/#media-endpoint">Media Endpoint</a>, then at the time you add the image to the interface, Quill uploads the file to your Media Endpoint and embeds it in the editor as an <code>&lt;img&gt;</code> tag pointing to the file on your server. When you publish the post, the HTML will contain this img tag.</p> <p>If your Micropub server supports a <a href="https://www.w3.org/TR/micropub/#media-endpoint">Media Endpoint</a>, then at the time you add the image to the interface, Quill uploads the file to your Media Endpoint and embeds it in the editor as an <code>&lt;img&gt;</code> tag pointing to the file on your server. When you publish the post, the HTML will contain this img tag.</p>
<pre>
<?= htmlspecialchars('<img src="https://media.example.com/image/10000.png">'); ?>
</pre>
<pre><?= htmlspecialchars('<img src="https://media.example.com/image/10000.png">'); ?></pre>
<p>If your Micropub server does not support a Media Endpoint, then when you add an image in the editor, the image is converted to a data URI, and will be sent to your Micropub endpoint when you publish the post. You don't need to do anything special to handle the image, since if you render this HTML directly, your viewers will see the image! Of course this means your HTML file will increase by the size of the image, so you may wish to implement a <a href="https://www.w3.org/TR/micropub/#media-endpoint">Media Endpoint</a> in order to handle images in your posts separately.</p> <p>If your Micropub server does not support a Media Endpoint, then when you add an image in the editor, the image is converted to a data URI, and will be sent to your Micropub endpoint when you publish the post. You don't need to do anything special to handle the image, since if you render this HTML directly, your viewers will see the image! Of course this means your HTML file will increase by the size of the image, so you may wish to implement a <a href="https://www.w3.org/TR/micropub/#media-endpoint">Media Endpoint</a> in order to handle images in your posts separately.</p>
<pre>
<?= htmlspecialchars('<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZIAAAET...'); ?>
</pre>
<pre><?= htmlspecialchars('<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZIAAAET...'); ?></pre>
<h3>Post Properties</h3> <h3>Post Properties</h3>
<p>The following properties will be sent in the Micropub request. This request will be sent as a standard form-encoded request.</p>
<p>The following properties will be sent in the Micropub request. This request will be sent as a JSON request.</p>
<p>The access token is sent in the Authorization HTTP header:</p> <p>The access token is sent in the Authorization HTTP header:</p>
<pre>Authorization: Bearer XXXXXXXXX</pre> <pre>Authorization: Bearer XXXXXXXXX</pre>
<ul> <ul>
<li><code>h=entry</code> - This indicates that this is a request to create a new <a href="https://indieweb.org/h-entry">h-entry</a> post.</li>
<li><code>name</code> - The title of your post.</li> <li><code>name</code> - The title of your post.</li>
<li><code>content[html]</code> - The full HTML of your post in the editor. This may include data-uri-encoded images.</li>
<li><code>category[]</code> - This property will be repeated for each tag you've entered in the "tags" field.</li>
<li><code>content.html</code> - The full HTML of your post in the editor. This may include data-uri-encoded images.</li>
<li><code>category</code> - This property will be repeated for each tag you've entered in the "tags" field.</li>
<li><code>mp-slug</code> - If you enter a slug, this will be sent in the request. You can customize the name of this property in settings.</li> <li><code>mp-slug</code> - If you enter a slug, this will be sent in the request. You can customize the name of this property in settings.</li>
<li><code>post-status</code> - If you choose "draft" from the status dropdown, then this property will be set to "draft". Otherwise, it will not be included in the request. This is an indication to your endpoint that this is a draft post and should not be made public. Of course it's up to your endpoint to implement draft posts in whatever way you choose.</li> <li><code>post-status</code> - If you choose "draft" from the status dropdown, then this property will be set to "draft". Otherwise, it will not be included in the request. This is an indication to your endpoint that this is a draft post and should not be made public. Of course it's up to your endpoint to implement draft posts in whatever way you choose.</li>
</ul> </ul>
<p>This will be sent as a JSON request, so the request will look something like the following.</p>
<pre>POST /micropub HTTP/1.1
Content-type: application/json
Authorization: Bearer XXXXXXXXXXX
{
"type": "h-entry",
"properties": {
"name": ["Post Title"],
"content": [
"html": "&lt;p&gt;The HTML contents of your post from the editor&lt;/p&gt;"
],
"mp-slug": ["slug"],
"category": ["foo","bar"]
}
}
</pre>
<hr> <hr>
<p>Back to <a href="/docs/creating-posts">Creating Posts</a></p> <p>Back to <a href="/docs/creating-posts">Creating Posts</a></p>

Loading…
Cancel
Save