diff --git a/markdown.tmpl b/markdown.tmpl
new file mode 100644
index 00000000..6d719255
--- /dev/null
+++ b/markdown.tmpl
@@ -0,0 +1,49 @@
+# Protocol Documentation
+{{range .Files}}
+{{$file_name := .Name}}
+
+
+## {{.Name}}
+{{.Description}}
+
+{{range .Messages}}
+
+
+### {{.LongName}}
+{{.Description}}
+
+{{ if .HasFields}}
+| Field | Type | Description |
+| ------| ---- | ----------- |
+{{range .Fields -}}
+| {{if .IsOneof -}}{{if eq .OneofDecl (printf "_%s" .Name)}}optional{{else}}oneof {{.OneofDecl}}
{{end}}
{{end}}{{.Name}} {{/* noline */ -}}
+| [{{if .IsMap}}map{{else}}{{.Label}} {{end}}{{.LongType}}](#{{.FullType | anchor}}) {{/* noline */ -}}
+| {{if (index .Options "deprecated" | default false)}}**deprecated**
{{end}}{{if .Description}}{{.Description | replace "\n" "
"}}{{end}} {{/* noline */ -}}
+|
+{{end}}{{/* range .Fields */}}
+{{- end}}{{/* if .HasFields */}}
+{{- end}}{{/* range .Messages */}}
+
+{{range .Enums}}
+
+
+### {{.LongName}}
+{{.Description}}
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+{{range .Values -}}
+ | {{.Name}} | {{.Number}} | {{nobr .Description}} |
+{{end}}
+
+{{end}}
+
+{{- end}}{{/* range .Files */}}
+
+## Scalar Value Types
+
+| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby |
+| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- |
+{{range .Scalars -}}
+ | {{.ProtoType}} | {{.Notes}} | {{.CppType}} | {{.JavaType}} | {{.PythonType}} | {{.GoType}} | {{.CSharp}} | {{.PhpType}} | {{.RubyType}} |
+{{end}}
diff --git a/protoc-gen-doc.sh b/protoc-gen-doc.sh
index 1815fdc7..82b6be4c 100755
--- a/protoc-gen-doc.sh
+++ b/protoc-gen-doc.sh
@@ -4,7 +4,8 @@ echo "Generating Markdown documentation $(pwd)/docs/markdown/protocol.md"
docker run --rm \
-v $(pwd)/docs/markdown:/out \
-v $(pwd)/protobuf_definitions:/protos \
- pseudomuto/protoc-gen-doc --doc_opt=markdown,protocol.md
+ -v $(pwd)/markdown.tmpl:/markdown.tmpl \
+ pseudomuto/protoc-gen-doc --doc_opt=markdown.tmpl,protocol.md
echo "Generating HTML documentation $(pwd)/docs/html/protocol.html"
docker run --rm \