Package: ixbrl-viewer
Arelle iXBRL ViewerTheArelleiXBRL Viewer allowsInline XBRL(or iXBRL) reports to be
viewed interactively in a web browser.  The viewer allows users to access the tagged XBRL data embedded in an iXBRL
report.  Key features include:Full text search on taxonomy labels and referencesView full details of tagged factsExport tables to ExcelVisualize and navigate calculation relationshipsProduce on-the-fly graphs using XBRL dataA sample viewer is provided in theexamplesfor those interested.The viewer project consists of two components:A plugin for theArelleXBRL toolThe Javascript viewer applicationIn order to view an iXBRL report in the viewer, it must first be prepared using
the Arelle plugin.  The preparation process updates the iXBRL file to include:A link to the JavaScript viewerA block of JSON data that contains the results of processing the XBRL data and associated taxonomyOnce prepared, the resulting file provides an entirely standalone viewer, and
does not require access to the taxonomy, or to any online services.  The only
dependency is on the JavaScript viewer application, which is a single file
which can be accessed directly online, downloaded or built locally.It is also possible to place the link to the viewer, and the block of JSON data
in a separate file.  See Stub Viewer Mode below.The JavaScript viewer application is a single JavaScript file called ixbrlviewer.js. It
contains all of the JavaScript that runs the viewer functionality.InstallationThe Python portion of this repo is developed using Python 3.12.Clone theiXBRL Viewer git repository.Download and installArelleAccessing the JavaScript viewer applicationAccessing via the CDNThe JavaScript file is available via a CDN. It can be accessed via the following url:https://cdn.jsdelivr.net/npm/ixbrl-viewer@<version>/iXBRLViewerPlugin/viewer/dist/ixbrlviewer.jsWhere<version>is the current version of ixbrl-viewer you are using. For instance1.2.0.Accessing via GithubWhen a new version of ixbrl-viewer is released, the javascript is included as a
release asset. The asset can be found on the releasespagefor each version of
the ixbrl-viewer.Building the JavaScript locallyInstall npm. Instructions can be found here:https://www.npmjs.com/get-npmInstall the dependencies for javascript by running:npm install.  This
command must be run from within theixbrl-viewer directory(i.e. the root
of your checkout of the repository).Runnpm run font. This will build the icon files.Runnpm run prod. This will create the ixbrlviewer.js in the
iXBRLViewerPlugin/viewer/dist directory.JavaScript VersioningThe ixbrl-viewer plugin embeds processed XBRL metadata in the HTML that has a
specific format read by the JavaScript. The metadata produced will work with a
viewer application that has the same major version, and the same or later minor
version as the plugin used to create it.This means that once an XBRL report has been prepared by the plugin, the
associated JavaScript viewer application can be upgraded within the same major
version.  Any features introduced in newer versions of the viewer that rely on
additional metadata will degrade gracefully if that metadata is not present.Producing an ixbrl-viewer via the Arelle GUIPreparing an iXBRL file via the GUIOpen Arelle and selectManage Pluginsfrom theHelpmenu.PressBrowseunder "Find plug-in modules".Browse to theiXBRLViewerPlugindirectory within your checkout of the iXBRL Viewer git repository and select
the__init__.pyfile within it.PressCloseand thenYeswhen prompted to restart Arelle.You should now have aSave iXBRL Viewer instanceon theToolsmenu.Open the ixbrl filing zip in ArelleSelectSave iXBRL Viewer instanceoption on theToolsmenuProvide ascript URLto theixbrlviewer.jsfile.This url can be one of the following:https://cdn.jsdelivr.net/npm/ixbrl-viewer@<version>/iXBRLViewerPlugin/viewer/dist/ixbrlviewer.jsA relative url to the downloaded ixviewer.js from githubA relative url to the locally built ixviewer.jsSave the viewer iXBRL file to a new file in the newly created directory by
selectingBrowse, browsing to the directory, and providing a file name.You should now be able to open the created file in Chrome, and the iXBRL viewer
should load.Preparing an iXBRL document set using the Arelle GUITo prepare an iXBRL document set, open the document set in Arelle.  The process
is as for a single file, except that a directory should be selected as the
output location, rather than a file.Producing an ixbrl-viewer via the Arelle command linePreparing an iXBRL file via the command lineThe plugin can also be used on the command line:python3Arelle/arelleCmdLine.py--plugins=<pathtoiXBRLViewerPlugin>-fixbrl-report.html--save-viewerixbrl-report-viewer.html--viewer-urlhttps://cdn.jsdelivr.net/npm/ixbrl-viewer@<version>/iXBRLViewerPlugin/viewer/dist/ixbrlviewer.jsNotes:"Arelle/arelleCmdLine.py" should be the path to your installation of ArelleThe plugin path needs to an absolute file path to the ixbrl-viewer pluginThe viewer url can be one of the following:https://cdn.jsdelivr.net/npm/ixbrl-viewer@<version>/iXBRLViewerPlugin/viewer/dist/ixbrlviewer.jsA relative url to the downloaded ixviewer.js from githubA relative url to the locally built ixviewer.jsPreparing an iXBRL document setThe iXBRL Viewer supports Inline XBRL document sets.  This requires theinlineXbrlDocumentSetplugin.
The input is specified using JSON in the following form:[{"ixds":[{"file":"file1.html"},{"file":"file2.html"},]}]The output must be specified as a directory.  For example:python3Arelle/arelleCmdLine.py--plugins'/path/to/iXBRLViewerPlugin|inlineXbrlDocumentSet'-f'[{"ixds":[{"file":"document1.html"},{"file":"document2.html"}]}]'--save-viewerout-dir--viewer-urlhttps://cdn.jsdelivr.net/npm/ixbrl-viewer@<version>/iXBRLViewerPlugin/viewer/dist/ixbrlviewer.jsNotes:The first file specified is the "primary" file, and should be opened in a
browser to use the viewer.  The other files will be loaded in separate tabs
within the viewer."Arelle/arelleCmdLine.py" should be the path to your installation of ArelleThe plugin path needs to an absolute file path to the ixbrl-viewer pluginThe viewer url can be one of the following:https://cdn.jsdelivr.net/npm/ixbrl-viewer@<version>/iXBRLViewerPlugin/viewer/dist/ixbrlviewer.jsA relative url to the downloaded ixviewer.js from githubA relative url to the locally built ixviewer.jsDue to browser security restrictions, the resulting viewer cannot be loaded
directly fromfile:URLs; it must be served by a web server.Using build-viewer.pyAs an alternative to the standard Arelle command line, thesamples/build-viewer.pyscript can also be used.  To use the script, both the
Arelle source code and the iXBRLViewerPlugin must be on the Python path. e.g.:PYTHONPATH=/path/to/Arelle:/path/to/ixbrl-viewer./samples/build-viewer.py--helpA document set can be processed by passing a directory as input.  All.htmland.xhtmlin the directory will be combined into a document set.  The
generated files will be saved into the directory specified by the--outoption.Taxonomy packages can be specified using--package-dir.  All ZIP files in the
specified directories will be loaded as taxonomy packages.e.g.PYTHONPATH=/path/to/Arelle:/path/to/ixbrl-viewer./samples/build-viewer.py--outout-dir--package-dir/my/packages/ixds-dirStub viewer modeBy default, the link to the JavaScript viewer and the JSON data block are added
to the iXBRL report file (or to the first file, in the case of a document set).Stub viewer mode is an optional generation mode that creates an additional,
minimal HTML file containing the JSON data block, and the link to the
JavaScript viewer.  This mode has two advantages over the default approach of
embedding the JSON data and JavaScript link in the iXBRL report:Provided that all facts and footnotes in the iXBRL report already have ID
attributes, no modification of the iXBRL report is required.The iXBRL viewer loading mask will be displayed much more quickly.  This is
helpful for very large iXBRL reports which can otherwise result in a long
delay before there is any sign of the iXBRL Viewer loading.The downside of this mode is that due to browser security restrictions, the
viewer cannot be loaded directly from files (usingfile:URLs); they must be
served by a web server.Optional FeaturesSome features are disabled by default but can be enabled at generation time or with query parameters.To enable features:Via CLI:--viewer-feature-{feature name}Via query parameter:?{feature name}=trueFeatures enabled by CLI/JSON can be disabled by query parameter via?{feature name}=false.
Note thatany other valuebesides "false" (case-sensitive) willenablethe feature.
This will override any enabling query parameters, so?review=true&review=false&review=truewould result in the 'review' feature being disabled.This table uses the 'review' feature as an example to demonstrate how these options interact:CLI/JSONQuery ParamResultunsetunsetdisabledunsettrueenabledunsetfalsedisabledreviewunsetenabledreviewtrueenabledreviewfalsedisabledFeature: Review ModeA review mode is available that is intended to assist in reviewing partially tagged or incomplete documents.
This mode replaces the namespace-based highlighting with optional highlighting based on untagged numbers and/or dates.CLI/JSONQuery Param--viewer-feature-review?review=trueDisable viewer loadingLoading of the viewer can be disabled by specifying?disable-vieweras a
query parameter.  This will leave the iXBRL document loaded in the browser, but
without any viewer functionality.  In the case of an iXBRL document set, or
multi-document viewer, the first document will be shown.Running testsRunning unit testsIn order to run the javascript unit tests make sure that you have installed all of the npm requirements.Run the following command to run javascript unit tests:npm run testIn order to run the python unit tests make sure that you have pip installed requirements-dev.txt.Run the following command to run python unit tests:pytest tests/unit_testsRunning Puppeteer testsAll commands should be run from repository rootInstall the npm requirements(instructions underBuilding the javascript locally).Install Arellepipinstallarelle-release.[Terminal 1] Start the puppeteer servenpmrunpuppeteerServeThis command generates theixbrlviewer.js, uses Arelle to generate several test files, then serves the files via a nodejs http-server.Currently changes to application code require restarting this step to take effect.Start the puppeteer tests[Terminal 2]:npmruntest:puppeteerIDE:Many of the IDE's on the market can run tests via the UI.  The following is an example configuration for intellij.  Once set you can right-click on the test name or file and select the run option.Debug runs with breakpoints are also typically supported.