Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc : notes de versions : créer un composant qui récupère un .md et le converti en html #3644

Open
DavidFyon opened this issue Jul 24, 2024 · 0 comments
Milestone

Comments

@DavidFyon
Copy link
Contributor

DavidFyon commented Jul 24, 2024

Ex d'utiliation dans la doc :

<doc-markdown-viewer url="https://github.com/assurance-maladie-digital/design-system/blob/v2-bridge/packages/synapse-bridge/CHANGELOG.md"></doc-markdown-viewer>

Image

src/components/global/DocMarkdownViewer.vue

Base de code :

<template>
	<div>
		<div v-html="renderedMarkdown"></div>
	</div>
</template>

<script lang="ts">
import Vue from 'vue';
import Component from 'vue-class-component';

@Component
export default class MarkdownViewer extends Vue {
	renderedMarkdown: string = '';

	mounted() {
		this.fetchAndRenderMarkdown();
	}

	async fetchAndRenderMarkdown() {
		try {
			const response = await fetch('https://github.com/assurance-maladie-digital/design-system/blob/v2-bridge/packages/synapse-bridge/CHANGELOG.md', {
				headers: {
					'Access-Control-Allow-Origin': '*'
				}
			});
			const markdownContent = await response.text();
			this.renderedMarkdown = this.markdownToHtml(markdownContent);
		} catch (error) {
			console.error('Error fetching Markdown file:', error);
		}
	}

	markdownToHtml(markdown: string): string {
		// TODO : convert to html
		return markdown;
	}
}
</script>
@DavidFyon DavidFyon added this to the v2.x milestone Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant