Skip to content

Commit

Permalink
Merge da22fef into dc83d83
Browse files Browse the repository at this point in the history
  • Loading branch information
yufeih authored Mar 19, 2023
2 parents dc83d83 + da22fef commit 1089c7b
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 15 deletions.
7 changes: 6 additions & 1 deletion templates/.stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
"**/docfx.scss"
],
"rules": {
"selector-class-pattern": null
"selector-class-pattern": null,
"font-family-no-missing-generic-family-keyword": [ true, {
"ignoreFontFamilies": [
"bootstrap-icons"
]
}]
}
}
1 change: 0 additions & 1 deletion templates/modern/layout/_master.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<meta name="docfx:tocrel" content="{{_tocRel}}">
{{#_noindex}}<meta name="searchOption" content="noindex">{{/_noindex}}
{{#_enableSearch}}<meta name="docfx:rel" content="{{_rel}}">{{/_enableSearch}}
{{#_enableNewTab}}<meta name="docfx:newtab" content="true">{{/_enableNewTab}}
{{#docurl}}<meta name="docfx:docurl" content="{{docurl}}">{{/docurl}}
{{#yamlmime}}<meta name="docfx:yamlmime" content="{{yamlmime}}">{{/yamlmime}}
{{/redirect_url}}
Expand Down
2 changes: 1 addition & 1 deletion templates/modern/src/docfx.scss
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ article {
}

@mixin adjust-icon {
font-family: bootstrap-icons, sans-serif;
font-family: bootstrap-icons;
position: relative;
margin-right: 0.5em;
top: 0.2em;
Expand Down
9 changes: 9 additions & 0 deletions templates/modern/src/markdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*/

/* External link icon */
a.external[href]::after {
font-family: bootstrap-icons;
content: "\F1C5";
font-size: .6rem;
margin: 0 .2em;
display: inline-block;
}

/* Alerts */
.alert h5 {
text-transform: uppercase;
Expand Down
20 changes: 9 additions & 11 deletions templates/modern/src/markdown.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

import { breakWord, meta } from './helper'
import { breakWord } from './helper'
import AnchorJs from 'anchor-js'
import { html, render } from 'lit-html'

Expand Down Expand Up @@ -67,8 +67,8 @@ function renderClickableImage() {

function shouldMakeClickable(): boolean {
return img.naturalWidth > MIN_CLICKABLE_IMAGE_SIZE &&
img.naturalHeight > MIN_CLICKABLE_IMAGE_SIZE &&
!imageLinks.includes(img)
img.naturalHeight > MIN_CLICKABLE_IMAGE_SIZE &&
!imageLinks.includes(img)
}
})
}
Expand Down Expand Up @@ -100,15 +100,13 @@ function renderAlerts() {
* Open external links to different host in a new window.
*/
function renderLinks() {
if (meta('docfx:newtab') === 'true') {
const links = document.links
for (let i = 0; i < links.length; i++) {
const link = links.item(i)
if (link.hostname !== window.location.hostname) {
link.target = '_blank'
}
document.querySelectorAll<HTMLAnchorElement>('article a[href]').forEach(a => {
if (a.hostname !== window.location.hostname && a.innerText.trim() !== '') {
a.target = '_blank'
a.rel = 'noopener noreferrer nofollow'
a.classList.add('external')
}
}
})
}

/**
Expand Down
2 changes: 1 addition & 1 deletion templates/modern/src/toc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ $expand-stub-width: 1.2rem;
display: inline-block;
width: $expand-stub-width;
cursor: pointer;
font-family: bootstrap-icons, sans-serif;
font-family: bootstrap-icons;
content: "\F285";
position: absolute;
margin-left: -$expand-stub-width;
Expand Down

0 comments on commit 1089c7b

Please sign in to comment.