-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add configuration option for specifying custom attributes #10
Comments
The YSlow extension has a very simple implementation of an options screen for reference: https://github.com/marcelduran/yslow/tree/master/src/chrome |
Sorry but I didn't quite understand your custom attributes. Then I just add theses attributes to the option parameter in the render method ? Opal.Asciidoctor.$render(data, ASCIIDOCTOR_OPTIONS); |
@mojavelinux I think I get it: http://asciidoctor.org/docs/user-manual/#attributes idprefix is a name attribute The preferred way is to insert attributes on top of the document ? |
Each entry is a key/value pair separated by whitespace. The value is optional. The default value is empty string. When a value is specified, a Here's the formal version of the sample attributes I gave:
Here's how that attribute list would look if passed to the
The Asciidoctor API understands how to parse space-separated options from a string. That makes it possible to capture and pass on custom attributes from the user using a simple text field. We could make the UI more complex, but we can start there at least.
It depends. For settings that are specific to a document, yes. For personal preferences that you want applied to all documents you render, passing a configuration string to the API is preferable. Remember, the extension is often rendering documents not under your control. I'll give you an example. Let's say I want to add a toc to all documents I view. I would set the following value on the extension's configuration screen:
Now I'm guaranteed to have a toc that overrides any document-specific setting. I think this would be a very nice feature. Make sense? |
Excellent! This opens the doors to lots of possibilities in the future. One minor thing. You can pass the attributes as a String and Asciidoctor |
...ah, except my point doesn't apply until we're on 0.1.4. So that change |
Add a configuration option for specifying custom attributes. Presumably, this entails adding an options page for the extension.
The custom attributes are intended as a user-preference for controlling how documents are rendered by the extension globally. Per-document attributes are best placed in the document being rendered, at least for now.
Since Asciidoctor can accept attributes as a String of space-separated key/value attribute pairs, its sufficient to use a simple String option. For example:
(the square brackets emulate an input field in the configuration dialog)
The text was updated successfully, but these errors were encountered: