Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 880 Bytes

manual.adoc

File metadata and controls

34 lines (25 loc) · 880 Bytes

Asciidoctor.js User Manual

API

How to set document attribute

You can set document attributes after loading AsciiDoc content.

var content = '== Title';
var doc = Opal.Asciidoctor.$load(content);
console.log(doc.$attr('data-uri')); // prints nil
console.log(doc.$attr('data-uri', 'false')); // prints 'false'

doc.$set_attribute('data-uri', 'true');
console.log(doc.$attr('data-uri')); // prints 'true'

How to unset/delete document attribute

You can unset document attributes after loading AsciiDoc content.

var content = '== Title';
var doc = Opal.Asciidoctor.$load(content);
doc.$set_attribute('data-uri', 'true');
console.log(doc.$attr('data-uri')); // prints 'true'

doc.attributes.$delete('data-uri');
doc.attribute_overrides.$delete('data-uri');
console.log(doc.$attr('data-uri')); // prints nil