diff --git a/S3.svg b/S3.svg
new file mode 100644
index 00000000..71903cee
--- /dev/null
+++ b/S3.svg
@@ -0,0 +1,12 @@
+
+
+
\ No newline at end of file
diff --git a/build.js b/build.js
index f16a571c..99f3f986 100644
--- a/build.js
+++ b/build.js
@@ -4,6 +4,7 @@ var path = require('path')
/* arguments:
all
index
+canvas
convert
assets
sitemap
@@ -44,7 +45,7 @@ function sanitizeAssetname(file) {
}
function loopMdFiles() {
- return fs.readdirSync(__dirname).filter(file => (file.slice(-3) === '.md') && (ignoreFiles.indexOf(file) != 0))
+ return fs.readdirSync(__dirname).filter(file => (path.extname(file) === '.md') && (ignoreFiles.indexOf(file) != 0))
}
const groupBy = key => array =>
@@ -54,6 +55,58 @@ const groupBy = key => array =>
return objectsByKeyValue;
}, {});
+function renderRect(node) {
+ return `\t\n`
+}
+
+function renderArrow(node) {
+ return `\t\n`
+}
+
+function convertCanvasToSVG(content) {
+ nodes = content['nodes']
+ edges = content['edges']
+
+ let svg = ""
+ svg += '\n'
+ svg += '\n'
+ svg += ''
+
+ return svg
+}
+
function convert(content, file) {
// Convert Obsidian cancas
@@ -153,6 +206,30 @@ if (!firstArg || ['all', 'index'].indexOf(firstArg) >= 0) {
console.log('Building title index finished.')
}
+
+if (!firstArg || ['all', 'canvas'].indexOf(firstArg) > 0) {
+
+ // log
+ console.log('Convert canvas files ...')
+
+ // Loop all cavas files
+ fs.readdirSync(__dirname).filter(file => (path.extname(file) === '.canvas')).forEach((file) => {
+
+ // Get file name
+ let fileName = file.replace('\.canvas', '')
+
+ // Get content
+ let content = fs.readFileSync(file, 'utf8')
+
+ content = convertCanvasToSVG(JSON.parse(content))
+
+ fs.writeFileSync(fileName + '.svg', content)
+ })
+
+ // log
+ console.log('Converting canvas files finished.')
+}
+
if (!firstArg || ['all', 'convert'].indexOf(firstArg) > 0) {
// log