### Load Plugin Folder and Listen Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/readme.md Loads a plugin from a specified folder path and starts a TiddlyWiki server. ```bash tiddlywiki ++./mygreatplugin mywiki --listen ``` -------------------------------- ### Install TiddlyWiki Globally Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/readme.md Installs TiddlyWiki globally on your system, making it accessible from any directory. ```bash npm install -g tiddlywiki ``` -------------------------------- ### Load Plugins and Listen Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/readme.md Loads specified plugins and starts a TiddlyWiki server. Use '+' for plugin names and '++' for plugin folder paths. ```bash tiddlywiki +plugins/tiddlywiki/filesystem +plugins/tiddlywiki/tiddlyweb mywiki --listen ``` -------------------------------- ### Install TiddlyWiki Globally Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/readme.md Installs the TiddlyWiki command-line tool globally using npm. This command is typically run in a terminal. ```bash npm install -g tiddlywiki ``` ```bash sudo npm install -g tiddlywiki ``` -------------------------------- ### Listen Command with Named Parameters Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/readme.md Starts the TiddlyWiki server using named parameters for configuration, which is useful for commands supporting many arguments. ```bash tiddlywiki wikipath --listen username=jeremy port=8090 ``` -------------------------------- ### Check TiddlyWiki Version Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/readme.md Verifies that TiddlyWiki has been installed correctly by displaying its current version number. This command should be run after the global installation. ```bash tiddlywiki --version ``` -------------------------------- ### Install Specific TiddlyWiki Version Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/readme.md Installs a specific prior version of TiddlyWiki using npm. Useful for compatibility or testing. ```bash npm install -g tiddlywiki@5.1.13 ``` -------------------------------- ### Serve TiddlyWiki5.com (Shell) Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/bin/readme.md Starts TiddlyWiki5 as an HTTP server. Use the -h parameter for help. Optional parameters include edition directory, username, password, host, and port. ```shell ./bin/serve.sh -h ./bin/serve.sh [edition dir] [username] [password] [host] [port] ``` -------------------------------- ### Start TiddlyWiki Server Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/readme.md Launches the TiddlyWiki server for the specified wiki directory. This command allows you to access and edit your wiki through a web browser. ```bash tiddlywiki mynewwiki --listen ``` -------------------------------- ### Serve TiddlyWiki5.com (Windows Batch) Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/bin/readme.md Starts TiddlyWiki5 as an HTTP server on Windows. Use the -h parameter for help. Optional parameters include edition directory, username, password, host, and port. ```batch ./bin/serve.cmd -h ./bin/serve.cmd [edition dir] [username] [password] [host] [port] ``` -------------------------------- ### Basic QR Code Generation Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/qrcode/files/qrcode/README.md Generates a QR code for the input string and returns it as a Base64 Data URI. Install the library using 'npm install yaqrcode'. ```javascript qrcode = require('yaqrcode'); base64 = qrcode('hello world'); ``` -------------------------------- ### Configure Html5QrcodeScanner with Supported Scan Types Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/qrcode/files/html5-qrcode/README.md Example of initializing Html5QrcodeScanner, limiting scan types to camera only. Ensure 'reader' element exists in the DOM. ```javascript function onScanSuccess(decodedText, decodedResult) { // handle the scanned code as you like, for example: console.log(`Code matched = ${decodedText}`, decodedResult); } let config = { fps: 10, qrbox: {width: 100, height: 100}, rememberLastUsedCamera: true, // Only support camera scan type. supportedScanTypes: [Html5QrcodeScanType.SCAN_TYPE_CAMERA] }; let html5QrcodeScanner = new Html5QrcodeScanner( "reader", config, /* verbose= */ false); html5QrcodeScanner.render(onScanSuccess); ``` -------------------------------- ### Update TiddlyWiki on Node.js Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/readme.md Use this command to upgrade TiddlyWiki if installed on Node.js. This is the standard method for most users. ```bash npm update -g tiddlywiki ``` -------------------------------- ### Parse BibTeX in Node.js Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/bibtex/files/README.md Install the package via npm and use require to import the library. Then, use the toJSON method to parse a BibTeX string. ```javascript var bibtexParse = require('bibtex-parse-js'); var sample = bibtexParse.toJSON('@article{sample1,title={sample title}}'); console.log(sample); ``` -------------------------------- ### Update TiddlyWiki on Node.js (Mac/Linux with sudo) Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/readme.md On Mac or Linux systems, you may need to use 'sudo' to update TiddlyWiki globally installed via Node.js. This grants the necessary permissions. ```bash sudo npm update -g tiddlywiki ``` -------------------------------- ### Handle Drag Start for TiddlyWiki Content Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/editions/dev/tiddlers/new/dragndropinterop.html Attaches a dragstart event listener to an element. When dragged, it sets the dataTransfer object with TiddlyWiki tiddler data in 'URL' format and a plain text string in 'Text' format. Use this to enable dragging content from your page into TiddlyWiki. ```javascript var titleString = "This is the string that appears when the block is dragged to a text input"; var tiddlerData = [ { title: "Tiddler One", text: "This is one of the payload tiddlers" }, { title: "Tiddler Two", text: "This is another of the payload tiddlers", "custom-field": "A custom field value" } ]; document.getElementById("draggable").addEventListener("dragstart",function(event) { event.dataTransfer.setData("URL","data:text/vnd.tiddler," + encodeURIComponent(JSON.stringify(tiddlerData))); event.dataTransfer.setData("Text",titleString); event.stopPropagation(); return false; }); ``` -------------------------------- ### SAX Stream API Usage Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/sax/files/README.md Illustrates how to use the SAX parser as a Node.js stream for processing XML files. This example shows error handling and how to pipe the stream for reading and writing files. ```javascript // stream usage // takes the same options as the parser var saxStream = require("sax").createStream(strict, options) saxStream.on("error", function (e) { // unhandled errors will throw, since this is a proper node // event emitter. console.error("error!", e) // clear the error this._parser.error = null this._parser.resume() }) saxStream.on("opentag", function (node) { // same object as above }) // pipe is supported, and it's readable/writable // same chunks coming in also go out. fs.createReadStream("file.xml") .pipe(saxStream) .pipe(fs.createWriteStream("file-copy.xml")) ``` -------------------------------- ### Initialize a New TiddlyWiki with Server Components Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/readme.md Creates a new directory for a TiddlyWiki instance and initializes it with necessary server-related files. This is the first step before running the wiki locally. ```bash tiddlywiki mynewwiki --init server ``` -------------------------------- ### Basic Command Structure Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/readme.md Illustrates the general syntax for TiddlyWiki CLI commands, including optional plugin loading and wiki path specification. ```bash tiddlywiki [+ | ++] [] [-- [[,]]] ``` -------------------------------- ### Build TiddlyWiki Index Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/editions/tiddlywiki-surveys/scripts/readme.md Run this command to build the TiddlyWiki index using Node.js, generating the final HTML file. ```bash node ./tiddlywiki.js ./editions/tiddlywiki-surveys --build index ``` -------------------------------- ### Serve TiddlyWiki5.com with Lazy Loading (Windows Batch) Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/bin/readme.md Serves TiddlyWiki5 content with lazy loading applied to images on Windows. Requires username and optionally password for authentication. ```batch ./bin/lazy.cmd [] ``` -------------------------------- ### Serve TiddlyWiki5.com with Lazy Loading (Shell) Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/bin/readme.md Serves TiddlyWiki5 content with lazy loading applied to images. Requires username and optionally password for authentication. ```shell ./bin/lazy.sh [] ``` -------------------------------- ### Build TiddlyWiki Project Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/readme.md Builds a TiddlyWiki project, typically used for generating static site output. ```bash tiddlywiki mynewwiki --build index ``` -------------------------------- ### Basic SAX Parser Usage Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/sax/files/README.md Demonstrates how to instantiate and use the SAX parser for processing an XML string. It shows how to set up event handlers for various parsing events like errors, text, opening tags, attributes, and the end of the document. ```javascript var sax = require("./lib/sax"), strict = true, // set to false for html-mode parser = sax.parser(strict); parser.onerror = function (e) { // an error happened. }; parser.ontext = function (t) { // got some text. t is the string of text. }; parser.onopentag = function (node) { // opened a tag. node has "name" and "attributes" }; parser.onattribute = function (attr) { // an attribute. attr has "name" and "value" }; parser.onend = function () { // parser stream is done, and ready to have more stuff written to it. }; parser.write('Hello, world!').close(); ``` -------------------------------- ### Import Great Interview Project JSON Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/editions/tiddlywiki-surveys/scripts/readme.md Execute this shell script in the repository root to import the extracted JSON data into the TiddlyWiki project. ```bash #!/bin/bash # This script imports the JSON data extracted from the Great Interview Project # into the TiddlyWiki survey edition. # Ensure the tmp directory exists mkdir -p tmp # Check if the JSON file exists if [ ! -f ./tmp/2010-great-interview-project.json ]; then echo "Error: ./tmp/2010-great-interview-project.json not found." echo "Please ensure you have extracted the tiddlers and saved the JSON file." exit 1 fi # Run the TiddlyWiki import command node ./tiddlywiki.js ./editions/tiddlywiki-surveys --import ./tmp/2010-great-interview-project.json echo "Import complete. The output will be displayed below." ``` -------------------------------- ### IIS web.config for TiddlyWiki Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/editions/ja-JP/tiddlers/saving/Example web.config for IIS.txt This web.config file configures IIS to use the httpPlatformHandler to serve a TiddlyWiki instance. It specifies the Node.js executable, arguments for running TiddlyWiki, and environment variables. ```xml ``` -------------------------------- ### DOMParser with Options and Error Handling Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/xmldom/files/readme.md Shows how to instantiate DOMParser with custom options, including a locator for error positioning and an overridden errorHandler for warnings and errors. ```javascript //added the options argument new DOMParser(options) //errorHandler is supported new DOMParser({ /** * locator is always need for error position info */ locator:{}, /** * you can override the errorHandler for xml parser * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html */ errorHandler:{warning:function(w){console.warn(w)},error:callback,fatalError:callback} //only callback model //errorHandler:function(level,msg){console.log(level,msg)} }) ``` -------------------------------- ### Configure Html5QrcodeScanner for Both Scan Types Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/qrcode/files/html5-qrcode/README.md Configures Html5QrcodeScanner to support both camera and file-based scanning. Ensure 'reader' element exists in the DOM. ```javascript supportedScanTypes: [ Html5QrcodeScanType.SCAN_TYPE_CAMERA, Html5QrcodeScanType.SCAN_TYPE_FILE] ] ``` -------------------------------- ### Create Node.js Symbolic Link on Debian Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/readme.md Creates a symbolic link for Node.js on Debian-based systems to resolve 'node: command not found' errors. Consult your distro's manual and 'whereis' for correct linking. ```bash sudo ln -s /usr/bin/nodejs /usr/bin/node ``` -------------------------------- ### Load and Render Tiddler Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/readme.md Loads a TiddlyWiki from an HTML file and renders a specific tiddler to a static HTML file. Useful for exporting content. ```bash tiddlywiki --verbose --load mywiki.html --render ReadMe ./readme.html ``` -------------------------------- ### Configure QR Box Dimensions Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/qrcode/files/html5-qrcode/README.md Set a fixed rectangular scanning area using the qrbox configuration. The rest of the viewfinder will be shaded. ```javascript let config = { qrbox : { width: 400, height: 150 } } ``` -------------------------------- ### Parsing XML with DOMParser Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/xmldom/files/readme.md Demonstrates how to use DOMParser to parse an XML string into a document object. Supports namespace declarations and attribute manipulation. ```javascript var DOMParser = require('xmldom').DOMParser; var doc = new DOMParser().parseFromString( ' ' +'\ttest\n' +'\t\n' +'\t\n' +'' ,'text/xml'); doc.documentElement.setAttribute('x','y'); doc.documentElement.setAttributeNS('./lite','c:x','y2'); var nsAttr = doc.documentElement.getAttributeNS('./lite','x') console.info(nsAttr) console.info(doc) ``` -------------------------------- ### Configure Html5QrcodeScanner for File-Based Scan Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/qrcode/files/html5-qrcode/README.md Sets the Html5QrcodeScanner to only support file-based scanning. Ensure 'reader' element exists in the DOM. ```javascript supportedScanTypes: [Html5QrcodeScanType.SCAN_TYPE_FILE] ``` -------------------------------- ### QR Code Generation with Custom Size Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/qrcode/files/qrcode/README.md Generates a QR code with a specified size. The 'size' option controls the dimensions of the generated QR code image. ```javascript qrcode = require('yaqrcode'); base64 = qrcode('hello world', { size: 500 }); ``` -------------------------------- ### Scan Only QR Code with Html5Qrcode Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/qrcode/files/html5-qrcode/README.md Initializes Html5Qrcode to scan only QR codes. Requires a 'reader' element in the DOM and specifies camera facing mode. ```javascript const html5QrCode = new Html5Qrcode( "reader", { formatsToSupport: [ Html5QrcodeSupportedFormats.QR_CODE ] }); const qrCodeSuccessCallback = (decodedText, decodedResult) => { /* handle success */ }; const config = { fps: 10, qrbox: { width: 250, height: 250 } }; // If you want to prefer front camera html5QrCode.start({ facingMode: "user" }, config, qrCodeSuccessCallback); ``` -------------------------------- ### Document Interface Methods Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/xmldom/files/readme.md Provides methods for creating and accessing elements within a DOM document. ```APIDOC ## Document Methods ### Description Methods available on DOM Document objects. ### Methods - **createElement(tagName)**: Creates an element with the given tag name. - **createDocumentFragment()**: Creates an empty DocumentFragment. - **createTextNode(data)**: Creates a Text node. - **createComment(data)**: Creates a Comment node. - **createCDATASection(data)**: Creates a CDATASection node. - **createProcessingInstruction(target, data)**: Creates a ProcessingInstruction node. - **createAttribute(name)**: Creates an Attribute node. - **createEntityReference(name)**: Creates an EntityReference node. - **getElementsByTagName(tagname)**: Returns a NodeList of all elements with the given tag name. - **importNode(importedNode, deep)**: Imports a node from another document. - **createElementNS(namespaceURI, qualifiedName)**: Creates an element with a namespace. - **createAttributeNS(namespaceURI, qualifiedName)**: Creates an attribute with a namespace. - **getElementsByTagNameNS(namespaceURI, localName)**: Returns a NodeList of elements with a given namespace and local name. - **getElementById(elementId)**: Returns the element with the specified ID. ``` -------------------------------- ### Scan Specific Formats with Html5QrcodeScanner Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/qrcode/files/html5-qrcode/README.md Configures Html5QrcodeScanner to support QR codes, UPC-A, UPC-E, and UPC-EAN-EXTENSION. Requires a 'reader' element in the DOM. ```javascript function onScanSuccess(decodedText, decodedResult) { // Handle the scanned code as you like, for example: console.log(`Code matched = ${decodedText}`, decodedResult); } const formatsToSupport = [ Html5QrcodeSupportedFormats.QR_CODE, Html5QrcodeSupportedFormats.UPC_A, Html5QrcodeSupportedFormats.UPC_E, Html5QrcodeSupportedFormats.UPC_EAN_EXTENSION, ]; const html5QrcodeScanner = new Html5QrcodeScanner( "reader", { fps: 10, qrbox: { width: 250, height: 250 }, formatsToSupport: formatsToSupport }, /* verbose= */ false); html5QrcodeScanner.render(onScanSuccess); ``` -------------------------------- ### Copy Tiddler Data to Clipboard Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/editions/dev/tiddlers/new/dragndropinterop.html Adds a click event listener to a button that copies TiddlyWiki tiddler data to the clipboard. It temporarily adds a 'copy' event listener to the document to set the clipboard data before executing the copy command. This allows users to paste content into TiddlyWiki via the clipboard. ```javascript document.getElementById("copy").addEventListener("click",function(event) { function listener(event) { event.clipboardData.setData("URL","data:text/vnd.tiddler," + encodeURIComponent(JSON.stringify(tiddlerData))); event.preventDefault(); } document.addEventListener("copy",listener); document.execCommand("copy"); document.removeEventListener("copy",listener); }); ``` -------------------------------- ### Set File-Based Scan as Default with Html5QrcodeScanner Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/qrcode/files/html5-qrcode/README.md Sets the file-based scan type as the default by ordering it before the camera scan type. Ensure 'reader' element exists in the DOM. ```javascript supportedScanTypes: [ Html5QrcodeScanType.SCAN_TYPE_FILE, Html5QrcodeScanType.SCAN_TYPE_CAMERA] ] ``` -------------------------------- ### Node Interface Methods Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/xmldom/files/readme.md Provides methods for manipulating and querying DOM nodes. ```APIDOC ## Node Methods ### Description Methods available on DOM Node objects. ### Methods - **insertBefore(newChild, refChild)**: Inserts a new node before a reference node. - **replaceChild(newChild, oldChild)**: Replaces an old node with a new node. - **removeChild(oldChild)**: Removes a child node. - **appendChild(newChild)**: Appends a new node as the last child. - **hasChildNodes()**: Returns true if the node has children, false otherwise. - **cloneNode(deep)**: Clones the node. If `deep` is true, clones all descendants. - **normalize()**: Merges adjacent text nodes and removes empty text nodes. - **isSupported(feature, version)**: Checks if a specific DOM feature is supported. - **hasAttributes()**: Returns true if the node has attributes, false otherwise. ``` -------------------------------- ### XMLSerializer Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/xmldom/files/readme.md Serializes a DOM node into an XML string. ```APIDOC ## XMLSerializer ### Description Serializes a DOM node into an XML string. ### Method ```javascript serializeToString(node) ``` ### Parameters - **node** (Node) - The DOM Node to serialize. ### Request Example ```javascript var serializer = new XMLSerializer(); var xmlString = serializer.serializeToString(doc); ``` ### Response #### Success Response - **string** - The XML string representation of the node. ``` -------------------------------- ### Element Interface Methods Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/xmldom/files/readme.md Provides methods for manipulating and querying element attributes and child elements. ```APIDOC ## Element Methods ### Description Methods available on DOM Element objects. ### Methods - **getAttribute(name)**: Returns the value of an attribute. - **setAttribute(name, value)**: Sets the value of an attribute. - **removeAttribute(name)**: Removes an attribute. - **getAttributeNode(name)**: Returns the Attr node representing the specified attribute. - **setAttributeNode(newAttr)**: Adds a new attribute node. - **removeAttributeNode(oldAttr)**: Removes an attribute node. - **getElementsByTagName(name)**: Returns a NodeList of all descendant elements with the given tag name. - **getAttributeNS(namespaceURI, localName)**: Returns the value of a namespaced attribute. - **setAttributeNS(namespaceURI, qualifiedName, value)**: Sets the value of a namespaced attribute. - **removeAttributeNS(namespaceURI, localName)**: Removes a namespaced attribute. - **getAttributeNodeNS(namespaceURI, localName)**: Returns the Attr node for a namespaced attribute. - **setAttributeNodeNS(newAttr)**: Adds a new namespaced attribute node. - **getElementsByTagNameNS(namespaceURI, localName)**: Returns a NodeList of descendant elements with a given namespace and local name. - **hasAttribute(name)**: Returns true if the element has the specified attribute, false otherwise. - **hasAttributeNS(namespaceURI, localName)**: Returns true if the element has the specified namespaced attribute, false otherwise. ``` -------------------------------- ### ProcessingInstruction Attributes Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/xmldom/files/readme.md Specifies attributes available for ProcessingInstruction nodes. ```APIDOC ## ProcessingInstruction ### Description Specifies attributes available for ProcessingInstruction nodes. ### Attributes - **data**: The text content of the processing instruction. ### Readonly Attributes - **target**: The target of the processing instruction. ``` -------------------------------- ### Define Supported QR Code Formats Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/qrcode/files/html5-qrcode/README.md TypeScript enum defining the various supported barcode and QR code formats for HTML5-Qrcode. ```typescript enum Html5QrcodeSupportedFormats { QR_CODE = 0, AZTEC = 1, CODABAR = 2, CODE_39 = 3, CODE_93 = 4, CODE_128 = 5, DATA_MATRIX = 6, MAXICODE = 7, ITF = 8, EAN_13 = 9, EAN_8 = 10, PDF_417 = 11, RSS_14 = 12, RSS_EXPANDED = 13, UPC_A = 14, UPC_E = 15, UPC_EAN_EXTENSION = 16, } ``` -------------------------------- ### Text Methods Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/xmldom/files/readme.md Extends CharacterData with methods specific to text nodes. ```APIDOC ## Text ### Description Extends CharacterData with methods specific to text nodes. ### Methods - **splitText(offset)**: Splits the text node into two at the specified offset. ``` -------------------------------- ### DOMParser Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/xmldom/files/readme.md Parses an XML string into a DOM document. Supports custom options for error handling and location tracking. ```APIDOC ## DOMParser ### Description Parses an XML string into a DOM document. ### Method ```javascript new DOMParser(options) parseFromString(xmlsource, mimeType) ``` ### Parameters #### Constructor Options - **options** (object) - Optional. Allows configuration of the parser. - **locator** (object) - Used for error position information. - **errorHandler** (object|function) - Custom error handler. Can be an object with `warning`, `error`, and `fatalError` methods, or a single function `errorHandler(level, msg)`. #### `parseFromString` Parameters - **xmlsource** (string) - The XML string to parse. - **mimeType** (string) - The MIME type of the document (e.g., 'text/xml'). ### Request Example ```javascript var parser = new DOMParser({errorHandler: function(level, msg) { console.log(level, msg); }}); var doc = parser.parseFromString('test', 'text/xml'); ``` ### Response #### Success Response - **Document** (object) - A W3C DOM Document object representing the parsed XML. ``` -------------------------------- ### Parse BibTeX in Browser Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/bibtex/files/README.md Include the bibtexParse.js file and use the toJSON method to parse a BibTeX string. ```javascript bibtexParse.toJSON('@article{sample1,title={sample title}}'); ``` -------------------------------- ### xmldom Node Extensions Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/xmldom/files/readme.md Describes extensions provided by the xmldom plugin for Node objects, including source position information. ```APIDOC ## xmldom Node Extensions ### Description Describes extensions provided by the xmldom plugin for Node objects. ### Attributes - **lineNumber**: The line number where the node appears in the source (1-based). - **columnNumber**: The column number where the node appears in the source (1-based). ``` -------------------------------- ### Notation Attributes Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/xmldom/files/readme.md Specifies attributes available for Notation nodes. ```APIDOC ## Notation ### Description Specifies attributes available for Notation nodes. ### Readonly Attributes - **publicId**: The public identifier of the notation. - **systemId**: The system identifier of the notation. ``` -------------------------------- ### Entity Attributes Source: https://github.com/tiddlywiki/tiddlywiki5/blob/master/plugins/tiddlywiki/xmldom/files/readme.md Specifies attributes available for Entity nodes. ```APIDOC ## Entity ### Description Specifies attributes available for Entity nodes. ### Readonly Attributes - **publicId**: The public identifier of the entity. - **systemId**: The system identifier of the entity. - **notationName**: The name of the notation for a parsed entity. ```