Skip to content

Commit 0eef61e

Browse files
committed
feat: md to html converter
1 parent 4529f7d commit 0eef61e

File tree

6 files changed

+283
-0
lines changed

6 files changed

+283
-0
lines changed

.gitignore

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/node
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=node
3+
4+
### Node ###
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
.pnpm-debug.log*
13+
14+
# Diagnostic reports (https://nodejs.org/api/report.html)
15+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
16+
17+
# Runtime data
18+
pids
19+
*.pid
20+
*.seed
21+
*.pid.lock
22+
23+
# Directory for instrumented libs generated by jscoverage/JSCover
24+
lib-cov
25+
26+
# Coverage directory used by tools like istanbul
27+
coverage
28+
*.lcov
29+
30+
# nyc test coverage
31+
.nyc_output
32+
33+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
34+
.grunt
35+
36+
# Bower dependency directory (https://bower.io/)
37+
bower_components
38+
39+
# node-waf configuration
40+
.lock-wscript
41+
42+
# Compiled binary addons (https://nodejs.org/api/addons.html)
43+
build/Release
44+
45+
# Dependency directories
46+
node_modules/
47+
jspm_packages/
48+
49+
# Snowpack dependency directory (https://snowpack.dev/)
50+
web_modules/
51+
52+
# TypeScript cache
53+
*.tsbuildinfo
54+
55+
# Optional npm cache directory
56+
.npm
57+
58+
# Optional eslint cache
59+
.eslintcache
60+
61+
# Optional stylelint cache
62+
.stylelintcache
63+
64+
# Microbundle cache
65+
.rpt2_cache/
66+
.rts2_cache_cjs/
67+
.rts2_cache_es/
68+
.rts2_cache_umd/
69+
70+
# Optional REPL history
71+
.node_repl_history
72+
73+
# Output of 'npm pack'
74+
*.tgz
75+
76+
# Yarn Integrity file
77+
.yarn-integrity
78+
79+
# dotenv environment variable files
80+
.env
81+
.env.development.local
82+
.env.test.local
83+
.env.production.local
84+
.env.local
85+
86+
# parcel-bundler cache (https://parceljs.org/)
87+
.cache
88+
.parcel-cache
89+
90+
# Next.js build output
91+
.next
92+
out
93+
94+
# Nuxt.js build / generate output
95+
.nuxt
96+
dist
97+
98+
# Gatsby files
99+
.cache/
100+
# Comment in the public line in if your project uses Gatsby and not Next.js
101+
# https://nextjs.org/blog/next-9-1#public-directory-support
102+
# public
103+
104+
# vuepress build output
105+
.vuepress/dist
106+
107+
# vuepress v2.x temp and cache directory
108+
.temp
109+
110+
# Docusaurus cache and generated files
111+
.docusaurus
112+
113+
# Serverless directories
114+
.serverless/
115+
116+
# FuseBox cache
117+
.fusebox/
118+
119+
# DynamoDB Local files
120+
.dynamodb/
121+
122+
# TernJS port file
123+
.tern-port
124+
125+
# Stores VSCode versions used for testing VSCode extensions
126+
.vscode-test
127+
128+
# yarn v2
129+
.yarn/cache
130+
.yarn/unplugged
131+
.yarn/build-state.yml
132+
.yarn/install-state.gz
133+
.pnp.*
134+
135+
### Node Patch ###
136+
# Serverless Webpack directories
137+
.webpack/
138+
139+
# Optional stylelint cache
140+
141+
# SvelteKit build / generate output
142+
.svelte-kit
143+
144+
# End of https://www.toptal.com/developers/gitignore/api/node
145+
146+
.vscode

commad-list.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Convert Markdown to HTML
2+
npm run convert-md

convert.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const fs = require('fs')
2+
const showdown = require('showdown')
3+
4+
// Create a new converter instance
5+
const converter = new showdown.Converter()
6+
7+
// Read your markdown file
8+
const markdown = fs.readFileSync('README.md', 'utf8')
9+
10+
// Convert the markdown to HTML
11+
const html = converter.makeHtml(markdown)
12+
13+
// Write the HTML output to a file
14+
fs.writeFileSync('index.html', html)
15+
16+
console.log('Conversion complete: index.html')

index.html

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<h1 id="djangoreactnativewebsocketdocs">django-reactnative-websocket-docs</h1>
2+
<p>Documentation for making realtime app using django as backend and react native as frontend</p>
3+
<p>Follow the step from https://github.com/mitchtabian/HOWTO-django-channels-daphne</p>
4+
<p>Thank you to <a href="https://github.com/mitchtabian">mitchtabian</a> !!!!</p>
5+
<h1 id="errorafterdeployment">Error after deployment</h1>
6+
<h3 id="1obtainatrustedssltlscertificate">1. Obtain a Trusted SSL/TLS Certificate</h3>
7+
<p>To resolve the "java.security.cert.CertPathValidatorException: Trust anchor for certification path not found" error, you need to obtain a valid SSL/TLS certificate from a trusted Certificate Authority (CA) like Let's Encrypt or a commercial CA. Make sure the certificate is properly configured on your WebSocket server.</p>
8+
<pre><code>openssl s_client -showcerts -connect your.domain.com:443 &lt; /dev/null
9+
</code></pre>
10+
<p>Copy the certificate starting from <strong>-----BEGIN CERTIFICATE-----</strong> to <strong>-----END CERTIFICATE-----</strong>, and save it as <strong>server.crt</strong>.</p>
11+
<pre><code>1 s:C = US, O = Let's Encrypt, CN = R3
12+
i:C = US, O = Internet Security Research Group, CN = ISRG Root X1
13+
a:PKEY: rsaEncryption, 2048 (bit); sigalg: RSA-SHA256
14+
v:NotBefore: Sep 4 00:00:00 2020 GMT; NotAfter: Sep 15 16:00:00 2025 GMT
15+
</code></pre>
16+
<h3 id="2includethesslcertificateinyourandroidproject">2. Include the SSL Certificate in Your Android Project</h3>
17+
<ul>
18+
<li>Place the <code>server.crt</code> certificate file in the <code>android/app/src/main/res/raw/</code> directory of your Android project.</li>
19+
</ul>
20+
<h3 id="3configurenetworksecurityforandroid">3. Configure Network Security for Android</h3>
21+
<ul>
22+
<li>Create a file named <code>network_security_config.xml</code> in the <code>android/app/src/main/res/xml/</code> directory.</li>
23+
</ul>
24+
<h3 id="4addthecertificatetothenetworksecurityconfiguration">4. Add the Certificate to the Network Security Configuration</h3>
25+
<p>Inside <code>network_security_config.xml</code>, add the following lines to include the <code>server.crt</code> certificate:</p>
26+
<pre><code class="xml language-xml">&lt;?xml version="1.0" encoding="utf-8"?&gt;
27+
&lt;network-security-config&gt;
28+
&lt;domain-config cleartextTrafficPermitted="true"&gt;
29+
&lt;domain includeSubdomains="true"&gt;10.0.2.2&lt;/domain&gt;&lt;!-- debugger --&gt;
30+
&lt;domain includeSubdomains="false"&gt;localhost&lt;/domain&gt;&lt;!-- Debug port without local server --&gt;
31+
&lt;domain includeSubdomains="true"&gt;YOUR_IP_ADDRESS&lt;/domain&gt;&lt;!-- Debug port --&gt;
32+
&lt;domain includeSubdomains="true"&gt;your_website.com&lt;/domain&gt;
33+
&lt;trust-anchors&gt;
34+
&lt;certificates src="@raw/server" /&gt;
35+
&lt;/trust-anchors&gt;
36+
&lt;/domain-config&gt;
37+
&lt;/network-security-config&gt;
38+
</code></pre>
39+
<h3 id="5referencethenetworksecurityconfigurationinandroidmanifestxml">5. Reference the Network Security Configuration in AndroidManifest.xml</h3>
40+
<p>In the android/app/src/main/AndroidManifest.xml file, add the following line to reference the network security configuration:</p>
41+
<pre><code class="xml language-xml">&lt;application
42+
...
43+
android:networkSecurityConfig="@xml/network_security_config"
44+
...&gt;
45+
</code></pre>
46+
<h3 id="6cleanandrebuildtheandroidproject">6. Clean and Rebuild the Android Project</h3>
47+
<pre><code>cd android
48+
./gradlew clean
49+
</code></pre>
50+
<h3 id="7runyourreactnativeapp">7. Run Your React Native App</h3>
51+
<p>After cleaning, run <strong><code>npx react-native run-android</code></strong> again to rebuild the project with the network security configuration.</p>
52+
<p>By following these steps, the error should be resolved, and your React Native app should be able to connect to the WebSocket server with the trusted SSL/TLS certificate.</p>

package-lock.json

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "django-reactnative-websocket-docs",
3+
"version": "1.0.0",
4+
"description": "Django React Native Websocket Documentations",
5+
"main": "index.js",
6+
"scripts": {
7+
"convert-md": "node convert.js",
8+
"test": "echo \"Error: no test specified\" && exit 1"
9+
},
10+
"repository": {
11+
"type": "git",
12+
"url": "git+https://github.com/ajitaro/django-reactnative-websocket-docs.git"
13+
},
14+
"keywords": [
15+
"django",
16+
"react-native",
17+
"websocket"
18+
],
19+
"author": "ajitaro",
20+
"license": "ISC",
21+
"bugs": {
22+
"url": "https://github.com/ajitaro/django-reactnative-websocket-docs/issues"
23+
},
24+
"homepage": "https://github.com/ajitaro/django-reactnative-websocket-docs#readme",
25+
"dependencies": {
26+
"showdown": "^2.1.0"
27+
}
28+
}

0 commit comments

Comments
 (0)