Commit 6611a836 authored by Phil Hughes's avatar Phil Hughes

Correctly render GFM in README files

Correctly renders GFM in README files in the repository listing
parent b4dca6d9
<script> <script>
import $ from 'jquery';
import '~/behaviors/markdown/render_gfm';
import { GlLink, GlLoadingIcon } from '@gitlab/ui'; import { GlLink, GlLoadingIcon } from '@gitlab/ui';
import getReadmeQuery from '../../queries/getReadme.query.graphql'; import getReadmeQuery from '../../queries/getReadme.query.graphql';
...@@ -30,6 +32,15 @@ export default { ...@@ -30,6 +32,15 @@ export default {
loading: 0, loading: 0,
}; };
}, },
watch: {
readme(newVal) {
if (newVal) {
this.$nextTick(() => {
$(this.$refs.readme).renderGFM();
});
}
},
},
}; };
</script> </script>
...@@ -45,7 +56,7 @@ export default { ...@@ -45,7 +56,7 @@ export default {
</div> </div>
<div class="blob-viewer"> <div class="blob-viewer">
<gl-loading-icon v-if="loading > 0" size="md" color="dark" class="my-4 mx-auto" /> <gl-loading-icon v-if="loading > 0" size="md" color="dark" class="my-4 mx-auto" />
<div v-else-if="readme" v-html="readme.html"></div> <div v-else-if="readme" ref="readme" v-html="readme.html"></div>
</div> </div>
</article> </article>
</template> </template>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment