Skip to content
Danny Lin edited this page Aug 28, 2016 · 2 revisions

ScrapBook X Data Scheme

  • <Firefox Profile Folder>: Get it from Help > Trobleshooting Information. The default path for Windows is %AppData%\Mozilla\Firefox\Profiles\<Random-String>.
  • <ScrapBook Profile Folder>: At <Firefox Profile Folder>/ScrapBook. You can also get it by selecting Profile Folder in the multi-ScrapBook list and then visit ScrapBook directory as below.
  • <ScrapBook Directory>: Get it from Sidebar > Tools > ScrapBook Directory.

ScrapBook Profile Folder

This folder is also a ScrapBook Directory, with the below additional config file:

  • multibook.txt: This file records other ScrapBook directories in the multi-ScrapBook besides the ScrapBook profile folder.

ScrapBook Directory

  • backup
  • data
    • <ID>
      • index.dat
      • index.html
      • index.css
      • sb-file2url.txt
      • sb-url2name.txt
      • sitemap.xml
      • sitemap.xsl
  • folders.txt
  • icon
  • tree: Files generated by Output HTML tree.
    • index.html
    • frame.html
    • index.css: The stylesheet used by index.html.
    • custom.css: Used by index.html and search.html for customized styles.
    • custom.js: Used by index.html and search.html for customized scripts.
    • output.css: The stylesheet used by index.html generated by older ScrapBook versions. Can be customized.
  • cache.rdf
  • collection.html
  • combine.css
  • combine.html
  • note.html
  • note_template.html
  • notex_template.html
  • scrapbook.rdf
  • search.html: The search page generated by Output HTML tree. (Placed in the main directory so that it works under a security restriction of Firefox)
  • sitemap.xsl

data/<ID>/index.html

For a general data type, its content is HTML 4.0 or HTML 5.0 compliant. If an XHTML page is saved, it will be saved as index.xhtml and this file will contain a meta refresh pointing to it.

If the data type is File, the content should be an HTML with meta refresh.

If the data type is Note, its content shall be:

<html><head><meta http-equiv="Content-Type" content="text/html;Charset=UTF-8"></head><body><pre>
<!-- Note content -->
</pre></body></html>

for cross-ScrapBook-version compatibility. Since ScrapBook X 1.13, the note content will be saved HTML-escaped.

If the data type is Folder, Separator, or Bookmark, this file does not exist.

data/<ID>/*.html

Special attributes for elements used by ScrapBook:

  • data-sb-obj attribute: Make thie element be handled by ScrapBook specially. Currently defined values are:
    • linemarker, inline, annotation, link-url, link-inner, link-file, freenote, etc.
    • sticky, block-comment: Defined in older ScrapBook versions. The latest ScrapBook X can read it but doesn't generate it.
    • custom: Mark the element as a ScrapBook-added one so that DOM erasor, Clear all ScrapBook Notes, or so remove it. You can fill it manually by editing HTML or used it in a customized HTML formatting template.
    • custom-wrapper: Similar to above, but DOM Eraser or so will preserve child elements in the element when removing it.
    • title: Content of the element will be replaced with the data title when the note page is saved.
    • title-src: The data title will be replaced with the content when the note page is saved.
    • todo: A todo checkbox whose check state will be saved when the page is saved.
    • stylesheet, stylesheet-temp: Special stylesheets handled by ScrapBook X and will not be modified when saving the page.
  • data-sb-id: Used in a ScrapBook-added highlight or inline annotation that groups elements with same value together.
  • data-sb-id-*: The identifier temporarily generated a page saving.
  • data-sb-orig-*: Records the original attribute name and value removed by ScrapBook during a page saving.
  • data-sb-indepth: Records the interlinks between pages by an in-depth saving.
  • data-sb-active: Records the status of a freenote.

data/<ID>/*.html, data/<ID>/*.css

Special URIs used by ScrapBook X:

  • urn:scrapbook-download:<UUID>: An identifier generated during a page saving.
  • urn:scrapbook-download:skip:<source-URI>: A URL skipped during a page saving.
  • urn:scrapbook-download:error:<source-URI>: A URL that cannot be downloaded due to an error during a page saving.

note_template.html

Below values will be replaced when performing an HTML view for a note:

  • <%NOTE_TITLE%>: Will be replaced with note title (the first line).
  • <%NOTE_CONTENT%>: Will be replaced with note content (since the second line).

notex_template.html

Below values can be used in a note page template and will be replaced with an appropriate value when creating a note page.

  • <%NOTE_TITLE%>: Will be replaced with the note page title, or the filename (without ".html") when creating a subpage.
  • <%SCRAPBOOK_DIR%>: Will be replaced with the path relative to the ScrapBook Directory. You can use this to refer to a common resource, for example, <link rel="stylesheet" href="<%SCRAPBOOK_DIR%>/common.css">.
  • <%DATA_DIR%>: Will be replaced with the path relative to the main directory of the data item. A sample usage is <script src="<%DATA_DIR%>/scripts/jQuery.js"></script>.

Additionally, these attributes can also be used:

  • data-sb-obj="title"
  • data-sb-obj="title-src"
  • data-sb-obj="todo"

Sample template: (default)

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title data-sb-obj="title"><%NOTE_TITLE%></title>
</head>
<body><%NOTE_TITLE%></body>
</html>

Sample template 2: (added a title and a common stylesheet)

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title data-sb-obj="title"><%NOTE_TITLE%></title>
  <link rel="stylesheet" href="<%SCRAPBOOK_DIR%>/common.css">
</head>
<body>
<h1 data-sb-obj="title-src"><%NOTE_TITLE%></h1>
<hr>
</body>
</html>