File tree Expand file tree Collapse file tree 3 files changed +71
-0
lines changed Expand file tree Collapse file tree 3 files changed +71
-0
lines changed Original file line number Diff line number Diff line change 1+ # Scrapbox to Markdown
2+
3+ A script to convert a Scrapbox page to markdown text. For bookmarklet.
4+
5+ ## How to use
6+
7+ Use ` main.min.js ` for bookmarklet.
8+
9+ ## How to develop
10+
11+ ### Prepare
12+
13+ ``` console
14+ npm install -g uglify-js
15+ ```
16+
17+ ### Generate ` main.min.js `
18+
19+ ``` console
20+ uglifyjs main.js --mangle --output main.min.js
21+ ```
Original file line number Diff line number Diff line change 1+ ( function ( ) {
2+
3+ // ============
4+ // scrapbox (=sb) nodes
5+ // ============
6+
7+ class SbNodePage { }
8+
9+ // ============
10+ // scrapbox parsers
11+ // ============
12+
13+ function parse ( doc ) {
14+ return new SbNodePage ( ) ;
15+ }
16+
17+ // ============
18+ // markdown (=md) nodes
19+ // ============
20+
21+ class MdNodeDocument {
22+ toString ( ) {
23+ return 'foo' ;
24+ }
25+ }
26+
27+ // ============
28+ // scrapbox to markdown converters
29+ // ============
30+
31+ function convert ( sbPage ) {
32+ return new MdNodeDocument ( ) ;
33+ }
34+
35+ // ============
36+ // main
37+ // ============
38+
39+ const sbPage = parse ( document ) ;
40+ const mdDoc = convert ( sbPage ) ;
41+
42+ // output
43+ const newDoc = window . open (
44+ '' , // url
45+ ) . document ;
46+ newDoc . title = 'conversion result' ;
47+ const textNode = newDoc . createTextNode ( mdDoc . toString ( ) ) ;
48+ newDoc . body . appendChild ( textNode ) ;
49+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments