{"id":16213786,"url":"https://github.com/akrck02/markdown-docs-dev-diary","last_synced_at":"2025-06-15T03:03:54.173Z","repository":{"id":119187693,"uuid":"457979649","full_name":"akrck02/markdown-docs-dev-diary","owner":"akrck02","description":"Development diary for the markdown-docs library.","archived":false,"fork":false,"pushed_at":"2022-02-10T23:50:35.000Z","size":439,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-15T03:03:49.742Z","etag":null,"topics":["dev-diary","markdown","parser"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akrck02.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-10T23:21:30.000Z","updated_at":"2025-01-02T08:40:20.000Z","dependencies_parsed_at":"2023-12-27T11:49:39.423Z","dependency_job_id":null,"html_url":"https://github.com/akrck02/markdown-docs-dev-diary","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"00a8c5846f50331a5ac7008d196dc587ec80034a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/akrck02/markdown-docs-dev-diary","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akrck02%2Fmarkdown-docs-dev-diary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akrck02%2Fmarkdown-docs-dev-diary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akrck02%2Fmarkdown-docs-dev-diary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akrck02%2Fmarkdown-docs-dev-diary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akrck02","download_url":"https://codeload.github.com/akrck02/markdown-docs-dev-diary/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akrck02%2Fmarkdown-docs-dev-diary/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259914898,"owners_count":22931324,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dev-diary","markdown","parser"],"created_at":"2024-10-10T11:08:27.923Z","updated_at":"2025-06-15T03:03:54.151Z","avatar_url":"https://github.com/akrck02.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Markdown docs\n\nA documentation parser from Markdown to HTML.\n\n## Understanding the parsing basics.\n\nThe parsing process is probably one of the most difficult tasks to handle in the IT world.\nBut, ***what the hell is parsing?***\n\nParsing is the process of getting information with a given format and converting that input into an output formatted in a different way.\n\nFor example parsing the date formats from:\n\n```tsx\n const myDate = \"20/12/2020 11:50\"; // Format dd/MM/yyyy hh:mm\n```\n\nTo the following date format\n\n```tsx\nconst myParsedDate = \"2020/12/20 11:50\"; // Format yyyy/MM/dd hh:mm\n```\n\nTo get the information inside the text **the code must understand the patterns living inside.**\n\n## Converting patterns into blocks\n\nThe code will take some piece of plain text and get the information blocks inside of it. So we need some kind of program to handle that, lets call it the **tokenizer.** \n\nImagine the following Markdown text\n\n```markdown\n# My title here\n\u003e aside paragraph for better visibility\n\n## Secondary title here\nNormal text with **bold** and *italic* \n```\n\nThe blocks inside\n\n```html\nTitle: My title here\nAside: aside paragraph for better visibility\n\nSecondaryTitle: Secondary title here\nText: Normal text with [Bold:bold] and [Italic: italic] \n```\n\nThe expected HTML output for our library\n\n```html\n\u003ch1\u003eMy title here\u003c/h1\u003e\n\u003cpre\u003e\n aside paragraph for better visibility\n\u003c/pre\u003e\n\n\u003ch2\u003eSecondary title here\u003c/h2\u003e\n\u003cp\u003eNormal text with \u003cb\u003ebold\u003c/b\u003e and \u003ci\u003eitalic\u003c/i\u003e\u003c/p\u003e\n```\n\nThe **tokenizer** must understand Markup language to get the block structure inside of it, but it is not the one who must translate that structure to the HTML output, that’s why we have another worker here, the **translator.**\n\n## Translating the Abstract Block Tree into different languages.\n\nYes, a translator must now the language you want it to work on, but if your parser is anyway modular, chances are that upgrading it with two or three of them  wont be a problem at all.\n\nThe basic idea here is that if the abstract tree is well formed, the translator will make basic comparative operations such us:\n\n```tsx\npublic String render( blocks : Block[] ) {\n\tlet output = \"\";\n\n\tblocks.forEach(block -\u003e {\n\t\tif(block.type == \"Text\") {\n\t\t\toutput += \"\u003cp\u003e\" + render(block.children) + \"\u003c/p\u003e\";\n\t\t}\n\t\t\n\t\tif(block.type == \"Title\") {\n\t\t\toutput += \"\u003ch1\u003e\" + render(block.children) + \"\u003c/h1\u003e\";\n\t\t}\n\n\t\t// --- Other type checkings ---\n\n\t\treturn block.text;\n\t});\n\n\treturn output;\n}\n```\n\n[Starting to code.](pages/1.StartingToCode.md)\n\n[Coding base abstractions](pages/2.CodingBaseAbstractions.md)\n\n[Problems](pages/3.Problems.md)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakrck02%2Fmarkdown-docs-dev-diary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakrck02%2Fmarkdown-docs-dev-diary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakrck02%2Fmarkdown-docs-dev-diary/lists"}