I can't get GitBook mermaid plugin to work, what a, i doing wrong? - gitbook

I'm new at Gitbook and can not get the mermaid plugin to work.
book.json
{
"plugins": ["mermaid-2"
],
"pluginsConfig": {
"mermaid-2": {
"theme": "forest"
}
} }
file.md : I put the code into fenced code block and tag it mermaid
mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
But it is not showing diagrams, it display as:
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
Please help me, why is this not working?

Since gitbook-plugin-mermaid-2 does not work as it is, you need to edit node_modules/gitbook-plugin-mermaid-2/index.js as below.(Around line 33)
js: [
'bower_components/mermaid/dist/mermaid.min.js',
'plugin.js'
]
then surround file.md with ```mermaid.

Related

Basic JSON - issue with the bloody bracket

For a while now I've been trying to add Airtouch to HOmebridge and failing miserably.
Current attempt
The original code is this
"platforms": [
{
"platform": "Airtouch",
"name": "Airtouch",
"ip_address": "192.168.0.10",
"ac_include_temps": false,
"units": [
{
"manufacturer": "LG",
"model": "B36AWY-7G6",
"fan": ["AUTO", "QUIET", "LOW", "MEDIUM"]
}
]
}
]
What am I missing? Happy to find someone to be able to troubleshoot & fix :)
Validation error:
Validation error
Thank you all, #user1239299 for sticking around, and #alexanderdavide for sharing the validator tool
I believe I figured out what the error was
I would love to know how to make it perfectly line up though:
enter image description here
At the moment it looks ugly. And when I move the lines of code to match the first picture, and upon saving the config, I get this. The last two brackets caused the issue :) :
enter image description here
The square brackets do align with each other

Issue parsing XLIFF with node XML parser

Im trying to parse XLIFF file using xml2js library. All is working fine but if I have something like that: <source>Welcome to <x id="INTERPOLATION" equiv-text="{{ title }}"/> my friend</source> I will get [{"_":"Welcome to my friend","x":[{"$":{"id":"INTERPOLATION","equiv-text":"{{ title }}"}}]}]. I am basically loosing order for the parts of the sentence. I would expect to get an array of 3 parts:
"Welcome to "
[{"$":{"id":"INTERPOLATION","equiv-text":"{{ title }}"}}]
" my friend"
But instead Im getting:
"Welcome to my friend"
[{"$":{"id":"INTERPOLATION","equiv-text":"{{ title }}"}}]
If I would try to recreate string again I would get <source>Welcome to my friend<x id="INTERPOLATION" equiv-text="{{ title }}"/></source>
Any idea how to solve it with this XML parser or any other?
you also might like txml. When using it like txml.parse(yourXMLString), you get an object like this:
[
{
"tagName": "source",
"attributes": {},
"children": [
"Welcome to ",
{
"tagName": "x",
"attributes": {
"id": "INTERPOLATION",
"equiv-text": "{{ title }}"
},
"children": []
},
" my friend"
]
}
]
I think it looks absolutely as what you are looking for. The three children inside the source, are very clean to use. Also, this parser is only 4kb in size and there is no need for native c compiling that will cause difficulties when running your app on a different architecture.
Disclaimer: I am the author of txml, and this opinion might not be objective ;-)
With fast-xml-parser.
Please, use stopNodes in options when you parse the source.
It makes fast-xml to treat the content as plain-strings
var parser = require("fast-xml-parser");
parser.parse(srcFile, {ignoreAttributes: false, stopNodes: ["source", "target"],});

Android Management API - Single App in Kiosk Mode - How to hide status and navigation bar?

What I would like to achieve?
For internal purposes only / within our enterprise only, I would like to have Android tablets, which run only one single app (made with Ionic/Angular) which even appears after restarting the tablet and the user is not able to leave it.
I think the technical description of what I would like to achieve is called a dedicated devices (formerly called corporate-owned single-use, or COSU).
How would I like to achieve it?
I would like to achieve this with Android Management API, which looks like a great choice for a MDM (Mobile Device Management) solution.
Here Google shows how to achieve this with an Android Management API policy.
The Problem?
I am not able to get rid of the status and navigation bar.
For testing purposes I tried to achieve this with the regular YouTube app. With "statusBarDisabled": true, I was able to disable the status bar, so the user can not interact with it, but it is still visible.
And same goes for the navigation bar with
"persistentPreferredActivities":[
{
"receiverActivity":"com.google.android.youtube",
"actions":[
"android.intent.action.MAIN"
],
"categories":[
"android.intent.category.HOME",
"android.intent.category.DEFAULT"
]
}
]
I was able to hide the home and recents buttons, but the back button is still there and the whole navigation bar is visible.
The following image visualises the problem:
Anyone an idea how I can get rid of the status and navigation bar completely?
This is how my whole policy looks like:
import json
policy_name = enterprise_name + '/policies/policy1'
policy_json = '''
{
"safeBootDisabled": true,
"statusBarDisabled": true,
"keyguardDisabled": true,
"screenCaptureDisabled": true,
"factoryResetDisabled": true,
"cameraDisabled": true,
"blockApplicationsEnabled": true,
"systemUpdate": {
"type": "WINDOWED",
"startMinutes": 120,
"endMinutes": 240
},
"policyEnforcementRules": [{
"settingName": "persistentPreferredActivities",
"blockAction": {
"blockAfterDays": 0
},
"wipeAction": {
"wipeAfterDays": 3,
"preserveFrp": true
}
}],
"applications": [
{
"packageName": "com.google.android.youtube",
"installType": "FORCE_INSTALLED",
"lockTaskAllowed": true,
"defaultPermissionPolicy": "GRANT"
}
],
"persistentPreferredActivities": [
{
"receiverActivity": "com.google.android.youtube",
"actions": [
"android.intent.action.MAIN"
],
"categories": [
"android.intent.category.HOME",
"android.intent.category.DEFAULT"
]
}
]
}
'''
androidmanagement.enterprises().policies().patch(
name=policy_name,
body=json.loads(policy_json)
).execute()
The two bars you've highlight are actually part of the youtube app NOT part of the android OS/UI. So you can't hide those using the device management API.

Stormcrawler XPathFilter - internal representation

When Stormcrawler fetches a website, it applies a configured XPathFilter on an HTML representation which is not the original one. E.g., tags are inserted, or DIVs will become H3, etc. E.g., the following configuration puts HTML code in Elasticsearch which is not the original one:
{
"com.digitalpebble.stormcrawler.parse.ParseFilters": [
{
"class": "com.digitalpebble.stormcrawler.parse.filter.XPathFilter",
"name": "XPathFilter",
"params": {
"canonical": "//*[#rel=\"canonical\"]/#href",
"parse.html": [
"//HTML"
]
}
},
{
"class": "com.digitalpebble.stormcrawler.parse.filter.DomainParseFilter",
"name": "DomainParseFilter",
"params": {
"key": "domain",
"byHost": false
}
}
]
}
This makes it hard to write XPath Expressions based on the original source code of the website. Is there any way to configure Stormcrawler in a way that it applies the XPathFilter expressions on the original website source code?
Which version of StormCrawler are you on? Are you using Tika for the parsing or Jsoup? AFAIK Jsoup does not modify the content but Tika probably does. I would recommend to use the JSoup-based ParserBolt for HTML content and Tika for anything else.
You can use the DebugParseFilter to see what the DOM looks like.

Sublime Text 3: how to show line numbers and bookmarks in distraction free mode?

It's quite easy to show/hide tabs or minimap in distruction free mode using View menu (Alt+V) or Ctr+Shift+P. Is it possible to do the same for line numbers and bookmark arrows?
Or maybe center whole text in a fullscreen mode? It would have the same effect.
It is not default behavior (keybinding). You can get line numbers, centering etc. only by modifying user config (Preferences -> Settings-More -> Distraction Free-User).
Add for example this:
{
"gutter": true,
"line_numbers": true
}
to get line numbers.
P.S. I was also looking for some shortcut for this. No luck. This is the only way I found for now.
Following the comment on the question by Keith Hall, you can do it by creating a custom keybinding. Open Key Bindings from the Preferences menu and add the following to your user keymap.
[
{
"keys": [ "ctrl+k", "ctrl+l" ],
"command": "toggle_setting",
"args": { "setting": "line_numbers" }
}
]
I chose ctrl-k, ctrl+l as the binding to match with the existing binding that hides the sidebar (ctrl-k, ctrl+b), but obviously it can be whatever you like. Search through the list of existing bindings to avoid a clash.
for line and column number open the setting file: (Preferences -> Settings-More -> Distraction Free-User)
{
"line_numbers": true,
"gutter": true,
"column_number": true,
}
OK, here is a solution ( ~/.config/sublime-text-3/Packages/User/Preferences.sublime-settings ):
{
"always_show_minimap_viewport": true,
"draw_centered": true,
"word_wrap": true,
"wrap_width": 80,
"font_size": 10,
"rulers":
[
80
]
}

Resources